react-text-forge 1.2.7 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/react-text-forge.js +3294 -2250
  2. package/dist/react-text-forge.umd.cjs +161 -248
  3. package/dist/{components → src/components}/ReactTextForge.d.ts +4 -4
  4. package/dist/src/components/utils/CustomEditor.d.ts +477 -0
  5. package/dist/{components → src/components}/utils/dropdown/BlockTypeDropdown.d.ts +1 -1
  6. package/dist/{components → src/components}/utils/dropdown/LanguageDropdown.d.ts +1 -1
  7. package/dist/{components → src/components}/utils/dropdown/TableDropdown.d.ts +1 -1
  8. package/dist/{components → src/components}/utils/form/ImageForm.d.ts +1 -1
  9. package/dist/src/index.d.ts +5 -0
  10. package/package.json +10 -5
  11. package/dist/components/decorators/withHightlight.d.ts +0 -1
  12. package/dist/components/utils/CustomEditor.d.ts +0 -241
  13. package/dist/components/utils/form/HistoryForm.d.ts +0 -6
  14. package/dist/index.d.ts +0 -5
  15. package/dist/main.d.ts +0 -2
  16. package/dist/react-text-forge.js.map +0 -1
  17. package/dist/react-text-forge.umd.cjs.map +0 -1
  18. /package/dist/{components → src/components}/FormatButton.d.ts +0 -0
  19. /package/dist/{components → src/components}/ReactTextForgeContext.d.ts +0 -0
  20. /package/dist/{components → src/components}/ThemeToggleButton.d.ts +0 -0
  21. /package/dist/{components → src/components}/Toolbar.d.ts +0 -0
  22. /package/dist/{components → src/components}/contexts/FullscreenContext.d.ts +0 -0
  23. /package/dist/{components → src/components}/contexts/ThemeContext.d.ts +0 -0
  24. /package/dist/{components → src/components}/functions/deserialize.d.ts +0 -0
  25. /package/dist/{components → src/components}/functions/deserializeDocx.d.ts +0 -0
  26. /package/dist/{components → src/components}/functions/serialize.d.ts +0 -0
  27. /package/dist/{components → src/components}/useToolbar.d.ts +0 -0
  28. /package/dist/{components → src/components}/utils/FullscreenButton.d.ts +0 -0
  29. /package/dist/{components → src/components}/utils/FullscreenWrapper.d.ts +0 -0
  30. /package/dist/{components → src/components}/utils/Images.d.ts +0 -0
  31. /package/dist/{components → src/components}/utils/Leaf.d.ts +0 -0
  32. /package/dist/{components → src/components}/utils/Tooltip.d.ts +0 -0
  33. /package/dist/{components → src/components}/utils/color.d.ts +0 -0
  34. /package/dist/{components → src/components}/utils/dropdown/BlockListDropdown.d.ts +0 -0
  35. /package/dist/{components → src/components}/utils/dropdown/BlockquoteButton.d.ts +0 -0
  36. /package/dist/{components → src/components}/utils/dropdown/ContainerDropdown.d.ts +0 -0
  37. /package/dist/{components → src/components}/utils/dropdown/FontFamilyDropdown.d.ts +0 -0
  38. /package/dist/{components → src/components}/utils/dropdown/FontSizeDropdown.d.ts +0 -0
  39. /package/dist/{components → src/components}/utils/elements/BlockquoteElement.d.ts +0 -0
  40. /package/dist/{components → src/components}/utils/elements/CodeElement.d.ts +0 -0
  41. /package/dist/{components → src/components}/utils/elements/DefaultElement.d.ts +0 -0
  42. /package/dist/{components → src/components}/utils/elements/ListElement.d.ts +0 -0
  43. /package/dist/{components → src/components}/utils/elements/TableElement.d.ts +0 -0
  44. /package/dist/{components → src/components}/utils/form/BulletTypeSelector.d.ts +0 -0
  45. /package/dist/{components → src/components}/utils/form/ColorPickerPopup.d.ts +0 -0
  46. /package/dist/{components → src/components}/utils/form/LinkForm.d.ts +0 -0
  47. /package/dist/{components → src/components}/utils/form/NumeredTypeSelector.d.ts +0 -0
  48. /package/dist/{components → src/components}/utils/form/TableForm.d.ts +0 -0
@@ -1,248 +1,161 @@
1
- (function(Y,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("slate"),require("react"),require("slate-react"),require("slate-history"),require("react-color"),require("slate-docx-deserializer")):typeof define=="function"&&define.amd?define(["exports","slate","react","slate-react","slate-history","react-color","slate-docx-deserializer"],d):(Y=typeof globalThis<"u"?globalThis:Y||self,d(Y.ReactTextForge={},Y.Slate,Y.React,Y.SlateReact,Y.SlateHistory,Y.ReactColor,Y.SlateDocxDeserializer))})(this,function(Y,d,j,se,We,Ue,Ze){"use strict";/*!
2
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
3
- *
4
- * Copyright (c) 2014-2017, Jon Schlinkert.
5
- * Released under the MIT License.
6
- */function ke(t){return Object.prototype.toString.call(t)==="[object Object]"}function Ge(t){var e,r;return ke(t)===!1?!1:(e=t.constructor,e===void 0?!0:(r=e.prototype,!(ke(r)===!1||r.hasOwnProperty("isPrototypeOf")===!1)))}function le(t){"@babel/helpers - typeof";return le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},le(t)}function Ye(t,e){if(le(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(le(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ke(t){var e=Ye(t,"string");return le(e)==="symbol"?e:String(e)}function ae(t,e,r){return e=Ke(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Ce=new WeakMap,je=new WeakMap;class me{}class de extends me{constructor(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),ae(this,"offset",void 0),ae(this,"path",void 0);var{offset:r,path:n}=e;this.offset=r,this.path=n}}class fe extends me{constructor(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),ae(this,"offset",void 0),ae(this,"path",void 0);var{offset:r,path:n}=e;this.offset=r,this.path=n}}var Xe=(t,e)=>{var r=t.text.length;Ce.set(t,[r,e])},Je=t=>Ce.get(t),Qe=(t,e)=>{var r=t.text.length;je.set(t,[r,e])},et=t=>je.get(t);function Fe(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function be(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Fe(Object(r),!0).forEach(function(n){ae(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fe(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var pe=new WeakSet,ge=t=>{var e=[],r=s=>{if(s!=null){var l=e[e.length-1];if(typeof s=="string"){var c={text:s};pe.add(c),s=c}if(d.Text.isText(s)){var o=s;d.Text.isText(l)&&pe.has(l)&&pe.has(o)&&d.Text.equals(l,o,{loose:!0})?l.text+=o.text:e.push(o)}else if(d.Element.isElement(s))e.push(s);else if(s instanceof me){var p=e[e.length-1];d.Text.isText(p)||(r(""),p=e[e.length-1]),s instanceof de?Xe(p,s):s instanceof fe&&Qe(p,s)}else throw new Error("Unexpected hyperscript child object: ".concat(s))}};for(var n of t.flat(1/0))r(n);return e};function tt(t,e,r){return new de(e)}function rt(t,e,r){return[new de(e),new fe(e)]}function Ee(t,e,r){return be(be({},e),{},{children:ge(r)})}function nt(t,e,r){return new fe(e)}function st(t,e,r){return ge(r)}function at(t,e,r){var n=r.find(l=>l instanceof de),s=r.find(l=>l instanceof fe);if(!n||n.offset==null||n.path==null)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!s||s.offset==null||s.path==null)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return be({anchor:{offset:n.offset,path:n.path},focus:{offset:s.offset,path:s.path}},e)}function ot(t,e,r){var n=ge(r);if(n.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var[s]=n;if(s==null&&(s={text:""}),!d.Text.isText(s))throw new Error(`
7
- The <text> hyperscript tag can only contain text content as children.`);return pe.delete(s),Object.assign(s,e),s}var lt=t=>(e,r,n)=>{var s=[],l;for(var c of n)d.Range.isRange(c)?l=c:s.push(c);var o=ge(s),p={},F=t();Object.assign(F,r),F.children=o;for(var[h,w]of d.Node.texts(F)){var g=Je(h),E=et(h);if(g!=null){var[M]=g;p.anchor={path:w,offset:M}}if(E!=null){var[A]=E;p.focus={path:w,offset:A}}}if(p.anchor&&!p.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!p.anchor&&p.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");return l!=null?F.selection=l:d.Range.isRange(p)&&(F.selection=p),F};function Se(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function ie(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Se(Object(r),!0).forEach(function(n){ae(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Se(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var it={anchor:tt,cursor:rt,editor:lt(d.createEditor),element:Ee,focus:nt,fragment:st,selection:at,text:ot},ct=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{elements:r={}}=e,n=dt(r),s=ie(ie(ie({},it),n),e.creators),l=ut(s);return l},ut=t=>{var e=function(n,s){for(var l=arguments.length,c=new Array(l>2?l-2:0),o=2;o<l;o++)c[o-2]=arguments[o];var p=t[n];if(!p)throw new Error("No hyperscript creator found for tag: <".concat(n,">"));s==null&&(s={}),Ge(s)||(c=[s].concat(c),s={}),c=c.filter(h=>!!h).flat();var F=p(n,s,c);return F};return e},dt=t=>{var e={},r=function(){var l=t[n];if(typeof l!="object")throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(n,"> tag you passed: ").concat(l));e[n]=(c,o,p)=>Ee("element",ie(ie({},l),o),p)};for(var n in t)r();return e},z=ct();/**
8
- * @license
9
- * Copyright (c) 2025 Jahylis
10
- *
11
- * This file is part of ReactTextForge.
12
- *
13
- * ReactTextForge is free software: you can redistribute it and/or modify
14
- * it under the terms of the MIT License as published by
15
- * the Open Source Initiative.
16
- *
17
- * ReactTextForge is distributed in the hope that it will be useful,
18
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- * MIT License for more details.
21
- *
22
- * You should have received a copy of the MIT License
23
- * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
24
- *
25
- * For any questions or suggestions, please contact: administrateur@nhumeria.fr
26
- */const ft=t=>{const r=new DOMParser().parseFromString(t,"text/html"),n=l=>{if(l.nodeType===Node.TEXT_NODE)return l.textContent;if(l.nodeType!==Node.ELEMENT_NODE)return null;const c=Array.from(l.childNodes).map(n).flat().filter(Boolean),o={bold:l.querySelector("strong")!==null,italic:l.querySelector("em")!==null,underline:l.querySelector("u")!==null,strikethrough:l.querySelector("del")!==null,subscript:l.querySelector("sub")!==null,superscript:l.querySelector("sup")!==null,bgColor:l.style.backgroundColor||l.querySelector("mark")&&l.querySelector("mark").style.backgroundColor,color:l.style.color,fontSize:l.style.fontSize,fontFamily:l.style.fontFamily,href:l.nodeName==="A"?l.getAttribute("href"):null,target:l.nodeName==="A"?l.getAttribute("target"):null,rel:l.nodeName==="A"?l.getAttribute("rel"):null};switch(l.nodeName){case"P":return z("element",{type:"paragraph"},c);case"PRE":return z("element",{type:"code"},c);case"UL":return z("element",{type:"bullet-list"},c);case"OL":return z("element",{type:"numbered-list"},c);case"LI":return z("element",{type:"list-item"},c);case"H1":return z("element",{type:"h1"},c);case"H2":return z("element",{type:"h2"},c);case"BLOCKQUOTE":return z("element",{type:"blockquote"},c);case"IMG":return z("element",{type:"image",url:l.getAttribute("src")});case"TABLE":return z("element",{type:"table"},c);case"TR":return z("element",{type:"table-row"},c);case"TD":return z("element",{type:"table-cell"},c);case"A":return z("element",{type:"link",url:l.getAttribute("href")},c);default:return c.map(p=>typeof p=="string"?z("text",o,p):p)}};return Array.from(r.body.childNodes).map(n).flat().filter(Boolean)};/**
27
- * @license
28
- * Copyright (c) 2025 Jahylis
29
- *
30
- * This file is part of ReactTextForge.
31
- *
32
- * ReactTextForge is free software: you can redistribute it and/or modify
33
- * it under the terms of the MIT License as published by
34
- * the Open Source Initiative.
35
- *
36
- * ReactTextForge is distributed in the hope that it will be useful,
37
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
38
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39
- * MIT License for more details.
40
- *
41
- * You should have received a copy of the MIT License
42
- * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
43
- *
44
- * For any questions or suggestions, please contact: administrateur@nhumeria.fr
45
- */const X=t=>t.map(e=>{if(d.Text.isText(e)){let r=e.text;const n=[];if(e.bold&&n.push(`<strong>${r}</strong>`),e.italic&&n.push(`<em>${r}</em>`),e.underline&&n.push(`<u>${r}</u>`),e.strikethrough&&n.push(`<del>${r}</del>`),e.subscript&&!e.superscript&&n.push(`<sub>${r}</sub>`),!e.subscript&&e.superscript&&n.push(`<sup>${r}</sup>`),e.bgColor&&n.push(`<mark style="background-color: ${e.bgColor}">${r}</mark>`),e.href){const l=e.color?` style="color: ${e.color}"`:"",c=e.target?` target="${e.target}"`:"",o=e.rel?` rel="${e.rel}"`:"";return`<a class="rtf" href="${e.href}"${c}${o}${l}>${n.length?n.join(""):r}</a>`}return`<span${` style="color: ${e.color}; font-size: ${e.fontSize}; font-family: ${e.fontFamily}"`}>${n.length>0?n.join(""):r}</span>`}return e.type==="paragraph"?`<p class="rtf">${X(e.children)}</p>`:e.type==="code"?`<pre class="rtf"><code>${X(e.children)}</code></pre>`:e.type==="bullet-list"?`<ul class="rtf">${X(e.children)}</ul>`:e.type==="numbered-list"?`<ol class="rtf">${X(e.children)}</ol>`:e.type==="list-item"?`<li class="rtf">${X(e.children)}</li>`:e.type==="h1"?`<h1 class="rtf">${X(e.children)}</h1>`:e.type==="h2"?`<h2 class="rtf">${X(e.children)}</h2>`:e.type==="blockquote"?`<blockquote class="rtf">${X(e.children)}</blockquote>`:e.type==="image"?`<img class="rtf" src="${e.url}" alt="" />`:e.type==="table"?`<table class="rtf"><tbody>${X(e.children)}</tbody></table>`:e.type==="table-row"?`<tr class="rtf">${X(e.children)}</tr>`:e.type==="table-cell"?`<td class="rtf">${X(e.children)}</td>`:e.type==="link"?`<a class="rtf" href="${e.url}">${X(e.children)}</a>`:""}).join("");var Te=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var he={exports:{}},ce={};/**
46
- * @license React
47
- * react-jsx-runtime.production.js
48
- *
49
- * Copyright (c) Meta Platforms, Inc. and affiliates.
50
- *
51
- * This source code is licensed under the MIT license found in the
52
- * LICENSE file in the root directory of this source tree.
53
- */var Ne;function gt(){if(Ne)return ce;Ne=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,s,l){var c=null;if(l!==void 0&&(c=""+l),s.key!==void 0&&(c=""+s.key),"key"in s){l={};for(var o in s)o!=="key"&&(l[o]=s[o])}else l=s;return s=l.ref,{$$typeof:t,type:n,key:c,ref:s!==void 0?s:null,props:l}}return ce.Fragment=e,ce.jsx=r,ce.jsxs=r,ce}var ue={};/**
54
- * @license React
55
- * react-jsx-runtime.development.js
56
- *
57
- * Copyright (c) Meta Platforms, Inc. and affiliates.
58
- *
59
- * This source code is licensed under the MIT license found in the
60
- * LICENSE file in the root directory of this source tree.
61
- */var Ae;function ht(){return Ae||(Ae=1,process.env.NODE_ENV!=="production"&&function(){function t(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===S?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case A:return"Fragment";case L:return"Profiler";case N:return"StrictMode";case v:return"Suspense";case y:return"SuspenseList";case x:return"Activity"}if(typeof m=="object")switch(typeof m.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),m.$$typeof){case M:return"Portal";case u:return(m.displayName||"Context")+".Provider";case i:return(m._context.displayName||"Context")+".Consumer";case b:var $=m.render;return m=m.displayName,m||(m=$.displayName||$.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case f:return $=m.displayName||null,$!==null?$:t(m.type)||"Memo";case C:$=m._payload,m=m._init;try{return t(m($))}catch{}}return null}function e(m){return""+m}function r(m){try{e(m);var $=!1}catch{$=!0}if($){$=console;var _=$.error,H=typeof Symbol=="function"&&Symbol.toStringTag&&m[Symbol.toStringTag]||m.constructor.name||"Object";return _.call($,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",H),e(m)}}function n(m){if(m===A)return"<>";if(typeof m=="object"&&m!==null&&m.$$typeof===C)return"<...>";try{var $=t(m);return $?"<"+$+">":"<...>"}catch{return"<...>"}}function s(){var m=T.A;return m===null?null:m.getOwner()}function l(){return Error("react-stack-top-frame")}function c(m){if(P.call(m,"key")){var $=Object.getOwnPropertyDescriptor(m,"key").get;if($&&$.isReactWarning)return!1}return m.key!==void 0}function o(m,$){function _(){I||(I=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",$))}_.isReactWarning=!0,Object.defineProperty(m,"key",{get:_,configurable:!0})}function p(){var m=t(this.type);return J[m]||(J[m]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),m=this.props.ref,m!==void 0?m:null}function F(m,$,_,H,W,Z,te,re){return _=Z.ref,m={$$typeof:E,type:m,key:$,props:Z,_owner:W},(_!==void 0?_:null)!==null?Object.defineProperty(m,"ref",{enumerable:!1,get:p}):Object.defineProperty(m,"ref",{enumerable:!1,value:null}),m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(m,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(m,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:te}),Object.defineProperty(m,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:re}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m}function h(m,$,_,H,W,Z,te,re){var B=$.children;if(B!==void 0)if(H)if(K(B)){for(H=0;H<B.length;H++)w(B[H]);Object.freeze&&Object.freeze(B)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(B);if(P.call($,"key")){B=t(m);var ee=Object.keys($).filter(function(oe){return oe!=="key"});H=0<ee.length?"{key: someKey, "+ee.join(": ..., ")+": ...}":"{key: someKey}",G[B+H]||(ee=0<ee.length?"{"+ee.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
62
- let props = %s;
63
- <%s {...props} />
64
- React keys must be passed directly to JSX without using spread:
65
- let props = %s;
66
- <%s key={someKey} {...props} />`,H,B,ee,B),G[B+H]=!0)}if(B=null,_!==void 0&&(r(_),B=""+_),c($)&&(r($.key),B=""+$.key),"key"in $){_={};for(var ne in $)ne!=="key"&&(_[ne]=$[ne])}else _=$;return B&&o(_,typeof m=="function"?m.displayName||m.name||"Unknown":m),F(m,B,Z,W,s(),_,te,re)}function w(m){typeof m=="object"&&m!==null&&m.$$typeof===E&&m._store&&(m._store.validated=1)}var g=j,E=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),u=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),S=Symbol.for("react.client.reference"),T=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=Object.prototype.hasOwnProperty,K=Array.isArray,U=console.createTask?console.createTask:function(){return null};g={"react-stack-bottom-frame":function(m){return m()}};var I,J={},D=g["react-stack-bottom-frame"].bind(g,l)(),O=U(n(l)),G={};ue.Fragment=A,ue.jsx=function(m,$,_,H,W){var Z=1e4>T.recentlyCreatedOwnerStacks++;return h(m,$,_,!1,H,W,Z?Error("react-stack-top-frame"):D,Z?U(n(m)):O)},ue.jsxs=function(m,$,_,H,W){var Z=1e4>T.recentlyCreatedOwnerStacks++;return h(m,$,_,!0,H,W,Z?Error("react-stack-top-frame"):D,Z?U(n(m)):O)}}()),ue}var Le;function mt(){return Le||(Le=1,process.env.NODE_ENV==="production"?he.exports=gt():he.exports=ht()),he.exports}var a=mt();const bt=({attributes:t,children:e,element:r})=>{const n=j.useRef(null),s=r.language||"plaintext";return a.jsxs("pre",{className:"rtf",...t,children:[a.jsx("div",{spellCheck:"false",className:"rtf code-language",children:s.toUpperCase()}),a.jsx("code",{ref:n,className:`language-${s}`,children:e})]})};/**
67
- * @license
68
- * Copyright (c) 2025 Jahylis
69
- *
70
- * This file is part of ReactTextForge.
71
- *
72
- * ReactTextForge is free software: you can redistribute it and/or modify
73
- * it under the terms of the MIT License as published by
74
- * the Open Source Initiative.
75
- *
76
- * ReactTextForge is distributed in the hope that it will be useful,
77
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
78
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
79
- * MIT License for more details.
80
- *
81
- * You should have received a copy of the MIT License
82
- * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
83
- *
84
- * For any questions or suggestions, please contact: administrateur@nhumeria.fr
85
- */const k={isMarkActive(t,e){const r=d.Editor.marks(t);return r?r[e]===!0:!1},toggleMark(t,e){k.isMarkActive(t,e)?d.Editor.removeMark(t,e):(d.Editor.addMark(t,e,!0),e==="subscript"?d.Editor.removeMark(t,"superscript"):e==="superscript"&&d.Editor.removeMark(t,"subscript"))},isBlockActive(t,e){const[r]=d.Editor.nodes(t,{match:n=>n.type===e});return!!r},isSelectionInList(t){const[e]=d.Editor.nodes(t,{match:r=>r.type==="bullet-list"||r.type==="numbered-list"});return!!e},getListStyleType(t){const[e]=d.Editor.nodes(t,{match:r=>r.type==="list-item"});return e[0].listStyleType},toggleBlock(t,e,r=null){const n=k.isBlockActive(t,e),s=e==="bullet-list"||e==="numbered-list";if((e==="h1"||e==="h2")&&d.Editor.removeMark(t,"fontSize"),s&&k.isSelectionInList(t)&&!r){d.Transforms.unwrapNodes(t,{match:c=>s&&!d.Editor.isEditor(c)&&d.Element.isElement(c)&&(c.type==="bullet-list"||c.type==="numbered-list"),split:!0}),d.Transforms.setNodes(t,{type:"paragraph"});return}if(r){d.Transforms.setNodes(t,{listStyleType:r});const c=d.Editor.range(t,t.selection).anchor.path;let o=c;c.length===3?o=o.slice(0,1):c.length===4&&(o=o.slice(0,2)),d.Transforms.setNodes(t,{type:e},{at:o})}else{d.Transforms.unwrapNodes(t,{match:o=>s&&!d.Editor.isEditor(o)&&d.Element.isElement(o)&&o.type===e,split:!0});const c={type:n?"paragraph":s?"list-item":e};if(d.Transforms.setNodes(t,c),!n&&s){const o={type:e,children:[]};d.Transforms.wrapNodes(t,o)}}},isAlignActive(t,e){const[r]=d.Editor.nodes(t,{match:n=>n.align===e});return!!r},toggleAlign(t,e){const r=k.isAlignActive(t,e);["alignLeft","center","right"].forEach(n=>{d.Transforms.unsetNodes(t,{align:n})}),r||d.Transforms.setNodes(t,{align:e})},canIndent(t,e){const[r]=d.Editor.nodes(t,{match:n=>n.type==="list-item"});if(r){const[,n]=r;if(e==="indent")return!(n.length>2);if(n.length>2)return!0}return!1},handleIndent(t){const[e]=d.Editor.nodes(t,{match:r=>r.type==="list-item"});if(e){const[,r]=e,n=d.Editor.above(t,{match:s=>["bullet-list","numbered-list"].includes(s.type)})[0].type;try{const s=d.Path.parent(d.Path.parent(r)),l=d.Editor.node(t,s);if(d.Element.isElement(l[0])&&l[0].type===n)return;const c={type:n,children:[]},o=[r[0],r[1]+1];d.Transforms.insertNodes(t,c,{at:o});const p={...d.Editor.node(t,r)[0]},F=[r[0],r[1]+1,0];d.Transforms.insertNodes(t,p,{at:F}),d.Transforms.removeNodes(t,{at:r}),d.Transforms.setNodes(t,{type:"list-item"},{at:[r[0],r[1],0]})}catch(s){console.error("Error indenting list item:",s)}}},handleOutdent(t){const[e]=d.Editor.nodes(t,{match:r=>r.type==="list-item"});if(e){const[,r]=e,n=d.Editor.above(t,{match:s=>["bullet-list","numbered-list"].includes(s.type)})[0].type;try{const s=d.Path.parent(r),l=d.Editor.node(t,s);d.Element.isElement(l)&&l.type===n?d.Transforms.liftNodes(t,{at:r}):d.Transforms.unwrapNodes(t,{at:s,match:c=>d.Element.isElement(c)&&c.type===n,split:!0}),d.Transforms.setNodes(t,{type:"list-item"},{at:r})}catch(s){console.error("Error dedenting list item:",s)}}},isLinkActive(t){const{selection:e}=t;if(!e)return!1;const[r]=d.Editor.nodes(t,{match:n=>!d.Editor.isEditor(n)&&d.Node.isNode(n)&&n.type==="link"});return!!r},updateLink(t,e,r){const n=r?"_blank":"_self",s=r?"noopener noreferrer":"";if(k.isLinkActive(t))d.Transforms.setNodes(t,{href:e,target:n,rel:s},{match:l=>l.type==="link"});else{const{selection:l}=t;if(!l||d.Range.isCollapsed(l))return;const c={text:e};d.Range.isCollapsed(l)?d.Transforms.insertNodes(t,{type:"link",href:e,target:n,rel:s,children:[c]}):d.Transforms.setNodes(t,{type:"link",href:e,target:n,rel:s},{match:o=>d.Text.isText(o),split:!0}),d.Transforms.removeNodes(t,{match:o=>o.type==="paragraph"&&o.children.length===0})}},removeLink(t){if(t.selection){const{selection:e}=t,[r,n]=d.Editor.node(t,e);if(r&&r.type==="link"){const s=r.text,l=d.Path.parent(n),c=d.Node.get(t,l);d.Transforms.insertNodes(t,{type:c.type!=="list-item"?c.type:"paragraph",text:s},{at:n,match:o=>d.Text.isText(o)}),d.Transforms.removeNodes(t,{at:n})}else console.warn("No link found at the current selection.")}else console.warn("No selection found. Cannot remove link.")},applyTextColor(t,e){const{selection:r}=t;r&&d.Editor.addMark(t,"color",e)},applyBackgroundTextColor(t,e){const{selection:r}=t;r&&d.Editor.addMark(t,"bgColor",e)},applyFontSize(t,e){const{selection:r}=t;r&&d.Editor.addMark(t,"fontSize",e)},applyFontFamily(t,e){const{selection:r}=t;r&&d.Editor.addMark(t,"fontFamily",e)},isSelectionInCode(t){const[e]=d.Editor.nodes(t,{match:r=>d.Element.isElement(r)&&r.type==="code"});return!!e},getCurrentCodeLanguage(t){const[e]=d.Editor.nodes(t,{match:r=>d.Element.isElement(r)&&r.type==="code"});return e?e[0].language:"plaintext"},handleCode(t,e){const{selection:r}=t;if(r){const[n]=d.Editor.nodes(t,{match:s=>s.type==="paragraph"});if(n){const[,s]=n,l=n[0].children.map(o=>o.text).join(""),c={type:"code",language:e,children:[{text:l}]};d.Transforms.setNodes(t,c,{at:s}),d.Transforms.select(t,s)}else{const[s]=d.Editor.nodes(t,{match:l=>l.type==="code"});if(s){const[,l]=s;if(e==="init"){const o={type:"paragraph",children:[{text:s[0].children.map(p=>p.text).join("")}]};d.Transforms.setNodes(t,o,{at:l}),d.Transforms.unsetNodes(t,"language",{at:l}),d.Transforms.select(t,l)}else d.Transforms.setNodes(t,{language:e},{at:l}),d.Transforms.select(t,l)}}}},toggleBlockquote(t){const e=this.isBlockquoteActive(t);d.Transforms.setNodes(t,{type:e?"paragraph":"blockquote"},{match:r=>d.Element.isElement(r)&&d.Editor.isBlock(t,r)})},isBlockquoteActive(t){const[e]=d.Editor.nodes(t,{match:r=>d.Element.isElement(r)&&r.type==="blockquote"});return!!e},insertCodeBlock(t,e){const r={type:"code",language:this.getCurrentCodeLanguage(t),children:[{text:e}]},{selection:n}=t;if(!n)return;const[s,l]=d.Editor.parent(t,n);d.Element.isElement(s)&&(s.type==="paragraph"||s.type==="code")&&d.Node.string(s)===""&&d.Transforms.removeNodes(t,{at:l}),d.Transforms.insertNodes(t,r);const c=d.Editor.end(t,[]);d.Transforms.select(t,c)},insertImage(t,e){const r={type:"image",url:e,children:[{text:""}]},n={type:"paragraph",children:[{text:""}]};d.Transforms.insertNodes(t,r),d.Transforms.insertNodes(t,n)},handleFileChange(t,e){if(t.target.files[0]){const n=t.target.files[0];if(n){const s=new Image,l=new FileReader;l.onload=c=>{n.type==="image/svg+xml"?this.insertImage(e,c.target.result):(s.src=c.target.result,s.onload=()=>{const p=document.createElement("canvas"),F=p.getContext("2d"),h=800,w=600;let g=s.width,E=s.height;g>E?g>h&&(E*=h/g,g=h):E>w&&(g*=w/E,E=w),p.width=g,p.height=E,F.drawImage(s,0,0,g,E);const M=p.toDataURL("image/jpeg");this.insertImage(e,M)},s.onerror=()=>{console.error("Failed to load image.")})},l.onerror=()=>{console.error("Failed to read file.")},l.readAsDataURL(n)}}},insertTable(t,e,r){const n={type:"table",children:Array.from({length:e},()=>({type:"table-row",children:Array.from({length:r},()=>({type:"table-cell",children:[{text:""}]}))}))};d.Transforms.insertNodes(t,n)},isSelectionInTable(t){const[e]=d.Editor.nodes(t,{match:r=>r.type==="table"});return!!e},getTableFromSelection(t){const[e]=d.Editor.nodes(t,{match:r=>r.type==="table"});return e?e[0]:null},addRow(t){var r;const e=k.getTableFromSelection(t);if(e){if(e.children.length>=5)return;const n=(r=t.selection)==null?void 0:r.anchor.path,s=n[1],l={type:"table-row",children:e.children[s].children.map(o=>({...o,children:[{text:""}]}))},c=[n.slice(0,1),s+1];d.Transforms.insertNodes(t,l,{at:c})}},addColumn(t){var r,n;const e=k.getTableFromSelection(t);if(e){if(((r=e.children[0])==null?void 0:r.children.length)>=5)return;const s=(n=t.selection)==null?void 0:n.anchor.path;if(d.Node.get(t,s)){const c=s[s.length-2];c!==void 0?e.children.forEach((o,p)=>{const F={type:"table-cell",children:[{text:""}]},h=[...s.slice(0,1),p,c+1];h[h.length-1]<=o.children.length?d.Transforms.insertNodes(t,F,{at:h}):console.warn(`Cannot insert at path ${h}. Row does not have enough cells.`)}):console.error("Column index is undefined, unable to find the selected cell in the row.")}else console.error("Selected cell not found.")}},deleteRow(t){var r;const e=k.getTableFromSelection(t);if(e){if(e.children.length===1)return;const n=(r=t.selection)==null?void 0:r.anchor.path,s=n[1];if(s!==void 0){const l=[n[0],s];d.Transforms.removeNodes(t,{at:l})}else console.error("Selected row index is undefined.")}},deleteColumn(t){var r,n;const e=k.getTableFromSelection(t);if(e){if(((r=e.children[0])==null?void 0:r.children.length)===1)return;const s=(n=t.selection)==null?void 0:n.anchor.path,l=d.Node.get(t,s),c=s[s.length-1];let o=-1;e.children[c].children.forEach((p,F)=>{p.children[0]===l&&(o=F)}),o!==-1&&e.children.forEach((p,F)=>{if(p.children.length>o){const h=[s[0],F,o];d.Node.get(t,h)?d.Transforms.removeNodes(t,{at:h}):console.error(`Invalid path: ${h}`)}})}},deleteTable(t){var r;if(k.getTableFromSelection(t)){const n=(r=t.selection)==null?void 0:r.anchor.path.slice(0,1);n.length>0?d.Transforms.removeNodes(t,{at:n}):console.error("Table path is invalid.")}else console.error("No table selected.")},findNearestTable(t){const{selection:e}=t;if(!e)return null;const r=[],n=d.Editor.nodes(t,{match:c=>d.Element.isElement(c)&&c.type==="table",at:[],mode:"all"});for(const c of n)r.push(c);if(r.length===0)return null;let s=null,l=1/0;for(const[c,o]of r){const p=d.Path.compare(e.anchor.path,o);Math.abs(p)<l&&(l=Math.abs(p),s=[c,o])}return s},insertParagraphBeforeTable(t){const e=this.findNearestTable(t);if(!e)return;const[,r]=e;d.Transforms.insertNodes(t,{type:"paragraph",children:[{text:""}]},{at:r})},insertParagraphAfterTable(t){const e=this.findNearestTable(t);if(!e)return;const[,r]=e,n=[r[0]+1];d.Transforms.insertNodes(t,{type:"paragraph",children:[{text:""}]},{at:n})}};/**
86
- * @license
87
- * Copyright (c) 2025 Jahylis
88
- *
89
- * This file is part of ReactTextForge.
90
- *
91
- * ReactTextForge is free software: you can redistribute it and/or modify
92
- * it under the terms of the MIT License as published by
93
- * the Open Source Initiative.
94
- *
95
- * ReactTextForge is distributed in the hope that it will be useful,
96
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
97
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98
- * MIT License for more details.
99
- *
100
- * You should have received a copy of the MIT License
101
- * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
102
- *
103
- * For any questions or suggestions, please contact: administrateur@nhumeria.fr
104
- */const xt=({attributes:t,children:e,element:r})=>{const n={textAlign:r.align||"left"};return a.jsx("p",{className:"rtf",style:n,...t,children:e})},vt=({attributes:t,children:e,leaf:r})=>{let n=[];r.bold&&n.push("strong"),r.italic&&n.push("em"),r.underline&&n.push("u"),r.strikethrough&&n.push("del"),r.subscript&&!r.superscript&&n.push("sub"),!r.subscript&&r.superscript&&n.push("sup"),r.bgColor&&n.push("mark");const s={color:r.color||void 0,fontSize:r.fontSize||void 0,backgroundColor:r.bgColor||void 0,fontFamily:r.fontFamily||void 0},l=c=>{c.stopPropagation(),r.target==="_blank"?(window.open(r.href,r.target,r.rel?{rel:r.rel}:void 0),c.preventDefault()):window.location.href=r.href};return r.href?a.jsx("a",{...t,href:r.href,target:r.target||"_self",rel:r.rel||"noopener noreferrer",style:s,onClick:l,children:n.length===0?e:n.reduceRight((c,o)=>j.createElement(o,{...t},c),e)}):n.length===0?a.jsx("span",{...t,style:s,className:r.className??"",children:e}):n.reduceRight((c,o)=>j.createElement(o,{...t,style:s},c),e)};/**
105
- * @license
106
- * Copyright (c) 2025 Jahylis
107
- *
108
- * This file is part of ReactTextForge.
109
- *
110
- * ReactTextForge is free software: you can redistribute it and/or modify
111
- * it under the terms of the MIT License as published by
112
- * the Open Source Initiative.
113
- *
114
- * ReactTextForge is distributed in the hope that it will be useful,
115
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
116
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
117
- * MIT License for more details.
118
- *
119
- * You should have received a copy of the MIT License
120
- * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
121
- *
122
- * For any questions or suggestions, please contact: administrateur@nhumeria.fr
123
- */const yt=({attributes:t,children:e,element:r})=>{const n={textAlign:r.align||"left",listStyleType:r.listStyleType||"disc"};switch(r.type){case"bullet-list":return a.jsx("ul",{className:"rtf",style:n,...t,children:e});case"numbered-list":return a.jsx("ol",{className:"rtf",style:n,...t,children:e});case"list-item":return a.jsx("li",{className:"rtf",style:n,...t,children:e});default:return a.jsx("p",{className:"rtf",style:n,...t,children:e})}};/**
124
- * @license
125
- * Copyright (c) 2025 Jahylis
126
- *
127
- * This file is part of ReactTextForge.
128
- *
129
- * ReactTextForge is free software: you can redistribute it and/or modify
130
- * it under the terms of the MIT License as published by
131
- * the Open Source Initiative.
132
- *
133
- * ReactTextForge is distributed in the hope that it will be useful,
134
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
135
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
136
- * MIT License for more details.
137
- *
138
- * You should have received a copy of the MIT License
139
- * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
140
- *
141
- * For any questions or suggestions, please contact: administrateur@nhumeria.fr
142
- */const wt=({attributes:t,children:e})=>a.jsx("blockquote",{className:"rtf",...t,style:{borderLeft:"4px solid #ccc",paddingLeft:"10px",color:"#666",margin:"20px 0"},children:e});/**
143
- * @license
144
- * Copyright (c) 2025 Jahylis
145
- *
146
- * This file is part of ReactTextForge.
147
- *
148
- * ReactTextForge is free software: you can redistribute it and/or modify
149
- * it under the terms of the MIT License as published by
150
- * the Open Source Initiative.
151
- *
152
- * ReactTextForge is distributed in the hope that it will be useful,
153
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
154
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
155
- * MIT License for more details.
156
- *
157
- * You should have received a copy of the MIT License
158
- * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
159
- *
160
- * For any questions or suggestions, please contact: administrateur@nhumeria.fr
161
- */function R(t){let e,r,n;if(t.startsWith("#"))t=t.replace(/^#/,""),e=parseInt(t.substring(0,2),16)/255,r=parseInt(t.substring(2,4),16)/255,n=parseInt(t.substring(4,6),16)/255;else if(t.startsWith("rgb")){const p=t.match(/\d+/g).map(Number);e=p[0]/255,r=p[1]/255,n=p[2]/255}else throw new Error("Format de couleur non pris en charge");const s=e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4),l=r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4),c=n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4);return .2126*s+.7152*l+.0722*c<.5}const $e=j.createContext({theme:"light",toggleTheme:()=>{},isDarkTheme:!1}),kt=({showTheme:t,backgroundDarkColor:e,borderDarkColor:r,imageDarkColor:n,children:s})=>{const[l,c]=j.useState("light");j.useEffect(()=>{if(t){const p=window.matchMedia("(prefers-color-scheme: dark)");c(p.matches?"dark":"light");const F=h=>{c(h.matches?"dark":"light")};return p.addEventListener("change",F),()=>{p.removeEventListener("change",F)}}},[]),j.useEffect(()=>{document.documentElement.setAttribute("data-theme",l)},[l]);const o=()=>{c(p=>p==="light"?"dark":"light")};return a.jsx($e.Provider,{value:{theme:l,toggleTheme:o,showTheme:t,isDarkTheme:l==="dark",backgroundDarkColor:e,borderDarkColor:r,imageDarkColor:n},children:s})},xe=()=>j.useContext($e),Me=j.createContext(),Ct=({backgroundColor:t,borderColor:e,imageColor:r,editor:n,children:s})=>{const{showTheme:l,isDarkTheme:c,backgroundDarkColor:o,borderDarkColor:p,imageDarkColor:F}=xe(),h=l&&c?o:t,w=l&&c?p:e,g=l&&c?F:r;return j.useEffect(()=>{document.documentElement.style.setProperty("--background-color",h),document.documentElement.style.setProperty("--border-color",w),document.documentElement.style.setProperty("--image-color",g)},[h,w,g]),a.jsx(Me.Provider,{value:{backgroundColor:h,borderColor:w,editor:n,imageColor:g},children:a.jsx("div",{className:"rtf react-text-forge",style:{backgroundColor:h,borderColor:w},children:s})})},q=()=>j.useContext(Me),jt=({onChange:t,selectStyle:e,toggleForm:r})=>{const n=[{value:"disc",label:"Disque"},{value:"circle",label:"Cercle"},{value:"square",label:"Carré"},{value:"'✔'",label:"Check"},{value:"'✘'",label:"Croix"},{value:"'➢'",label:"Petite flèche"},{value:"'➔'",label:"Flèche épaisse"}],{editor:s}=q();return a.jsx("ul",{onMouseLeave:()=>r(!1),style:e,className:"rtf dropdown-menu",children:n.map(l=>a.jsx("li",{value:l.value,onClick:()=>t(l.value),style:{backgroundColor:`${l.value===k.getListStyleType(s)?`color-mix(in srgb, ${e.backgroundColor} 80%, ${R(e.backgroundColor)?"white":"black"})`:e.backgroundColor}`},children:l.label},l.value))})},Ft=({onChange:t,selectStyle:e,toggleForm:r})=>{const n=[{value:"decimal",label:"Décimal"},{value:"upper-roman",label:"Lettres Romaines majuscules"},{value:"lower-roman",label:"Lettres Romaines minuscules"},{value:"upper-greek",label:"Lettres Grecques majuscules"},{value:"lower-greek",label:"Lettres Grecques minuscules"}],{editor:s}=q();return a.jsx("ul",{onMouseLeave:()=>r(!1),style:e,className:"rtf dropdown-menu",children:n.map(l=>a.jsx("li",{value:l.value,onClick:()=>t(l.value),style:{backgroundColor:`${l.value===k.getListStyleType(s)?`color-mix(in srgb, ${e.backgroundColor} 80%, ${R(e.backgroundColor)?"white":"black"})`:e.backgroundColor}`},children:l.label},l.value))})};/**
162
- * @license
163
- * Copyright (c) 2025 Jahylis
164
- *
165
- * This file is part of ReactTextForge.
166
- *
167
- * ReactTextForge is free software: you can redistribute it and/or modify
168
- * it under the terms of the MIT License as published by
169
- * the Open Source Initiative.
170
- *
171
- * ReactTextForge is distributed in the hope that it will be useful,
172
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
173
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
174
- * MIT License for more details.
175
- *
176
- * You should have received a copy of the MIT License
177
- * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
178
- *
179
- * For any questions or suggestions, please contact: administrateur@nhumeria.fr
180
- */function V({format:t,imageColor:e}){return(()=>{switch(t){case"addColumn":return a.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("g",{id:"Edit / Add_Column",children:a.jsx("path",{id:"Vector",d:"M5 17H8M8 17H11M8 17V14M8 17V20M14 21H15C16.1046 21 17 20.1046 17 19V5C17 3.89543 16.1046 3 15 3H13C11.8954 3 11 3.89543 11 5V11",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"addRow":return a.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("g",{id:"Edit / Add_Row",children:a.jsx("path",{id:"Vector",d:"M3 14V15C3 16.1046 3.89543 17 5 17L19 17C20.1046 17 21 16.1046 21 15L21 13C21 11.8954 20.1046 11 19 11H13M10 8H7M7 8H4M7 8V5M7 8V11",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"bgColor":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:a.jsx("path",{fill:e,d:"M86.6 9.4C74.1-3.1 53.9-3.1 41.4 9.4s-12.5 32.8 0 45.3L122.7 136 30.6 228.1c-37.5 37.5-37.5 98.3 0 135.8L148.1 481.4c37.5 37.5 98.3 37.5 135.8 0L474.3 290.9c28.1-28.1 28.1-73.7 0-101.8L322.9 37.7c-28.1-28.1-73.7-28.1-101.8 0L168 90.7 86.6 9.4zM168 181.3l49.4 49.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L213.3 136l53.1-53.1c3.1-3.1 8.2-3.1 11.3 0L429.1 234.3c3.1 3.1 3.1 8.2 0 11.3L386.7 288 67.5 288c1.4-5.4 4.2-10.4 8.4-14.6L168 181.3z"})});case"blockCode":return a.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none",children:a.jsx("path",{fill:e,fillRule:"evenodd",d:"M2 6a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V6zm5 1a1 1 0 0 0 0 2h5a1 1 0 1 0 0-2H7zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2h-2zm-8 4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2H7zm4 0a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6zm-4 4a1 1 0 1 0 0 2h5a1 1 0 1 0 0-2H7zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2h-2z",clipRule:"evenodd"})});case"blockquote":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:a.jsx("path",{fill:e,d:"M448 296c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72zm-256 0c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72z"})});case"bold":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",children:a.jsx("path",{fill:e,d:"M0 64C0 46.3 14.3 32 32 32l48 0 16 0 128 0c70.7 0 128 57.3 128 128c0 31.3-11.3 60.1-30 82.3c37.1 22.4 62 63.1 62 109.7c0 70.7-57.3 128-128 128L96 480l-16 0-48 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l16 0 0-160L48 96 32 96C14.3 96 0 81.7 0 64zM224 224c35.3 0 64-28.7 64-64s-28.7-64-64-64L112 96l0 128 112 0zM112 288l0 128 144 0c35.3 0 64-28.7 64-64s-28.7-64-64-64l-32 0-112 0z"})});case"bulletList":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:a.jsx("path",{fill:e,d:"M64 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM64 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm48-208a48 48 0 1 0 -96 0 48 48 0 1 0 96 0z"})});case"center":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:a.jsx("path",{fill:e,d:"M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z"})});case"color":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:a.jsx("path",{fill:e,d:"M512 256c0 .9 0 1.8 0 2.7c-.4 36.5-33.6 61.3-70.1 61.3L344 320c-26.5 0-48 21.5-48 48c0 3.4 .4 6.7 1 9.9c2.1 10.2 6.5 20 10.8 29.9c6.1 13.8 12.1 27.5 12.1 42c0 31.8-21.6 60.7-53.4 62c-3.5 .1-7 .2-10.6 .2C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256zM128 288a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm0-96a32 32 0 1 0 0-64 32 32 0 1 0 0 64zM288 96a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm96 96a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"})});case"deleteColumn":return a.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("g",{id:"Edit / Delete_Column",children:a.jsx("path",{id:"Vector",d:"M10 21H9C7.89543 21 7 20.1046 7 19V5C7 3.89543 7.89543 3 9 3H11C12.1046 3 13 3.89543 13 5V11M19 16H13",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"deleteRow":return a.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("g",{id:"Edit / Delete_Row",children:a.jsx("path",{id:"Vector",d:"M14 16H20M21 10V9C21 7.89543 20.1046 7 19 7H5C3.89543 7 3 7.89543 3 9V11C3 12.1046 3.89543 13 5 13H11",stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"deleteTable":return a.jsx("svg",{className:"rtf",fill:e,width:"800px",height:"800px",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M1800 1740c0 33-26.88 60-60 60H180c-33.12 0-60-27-60-60V180c0-33.12 26.88-60 60-60h1560c33.12 0 60 26.88 60 60v1560ZM1740 0H180C80.76 0 0 80.76 0 180v1560c0 99.24 80.76 180 180 180h1560c99.24 0 180-80.76 180-180V180c0-99.24-80.76-180-180-180Zm-235.08 245.388L960 790.308l-544.92-544.92-169.68 169.68 544.92 544.92-544.92 544.92 169.68 169.68L960 1129.668l544.92 544.92 169.68-169.68-544.92-544.92 544.92-544.92-169.68-169.68Z",fillRule:"evenodd"})});case"enter":return a.jsx("svg",{className:"rtf",viewBox:"0 0 24 24",fill:"none",children:a.jsx("path",{stroke:e,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",d:"M20 7V8.2C20 9.88016 20 10.7202 19.673 11.362C19.3854 11.9265 18.9265 12.3854 18.362 12.673C17.7202 13 16.8802 13 15.2 13H4M4 13L8 9M4 13L8 17"})});case"fullscreen":return a.jsxs("svg",{className:"rtf",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("path",{fill:e,d:"M4 2C2.89543 2 2 2.89543 2 4V8C2 8.55228 2.44772 9 3 9C3.55228 9 4 8.55228 4 8V4H8C8.55228 4 9 3.55228 9 3C9 2.44772 8.55228 2 8 2H4Z"}),a.jsx("path",{fill:e,d:"M20 2C21.1046 2 22 2.89543 22 4V8C22 8.55228 21.5523 9 21 9C20.4477 9 20 8.55228 20 8V4H16C15.4477 4 15 3.55228 15 3C15 2.44772 15.4477 2 16 2H20Z"}),a.jsx("path",{fill:e,d:"M20 22C21.1046 22 22 21.1046 22 20V16C22 15.4477 21.5523 15 21 15C20.4477 15 20 15.4477 20 16V20H16C15.4477 20 15 20.4477 15 21C15 21.5523 15.4477 22 16 22H20Z"}),a.jsx("path",{fill:e,d:"M2 20C2 21.1046 2.89543 22 4 22H8C8.55228 22 9 21.5523 9 21C9 20.4477 8.55228 20 8 20H4V16C4 15.4477 3.55228 15 3 15C2.44772 15 2 15.4477 2 16V20Z"})]});case"fullscreenExit":return a.jsxs("svg",{className:"rtf",viewBox:"0 0 24 24",fill:"none",children:[a.jsx("path",{fill:e,d:"M7 9C8.10457 9 9 8.10457 9 7V3C9 2.44772 8.55228 2 8 2C7.44772 2 7 2.44772 7 3V7H3C2.44772 7 2 7.44772 2 8C2 8.55228 2.44772 9 3 9H7Z"}),a.jsx("path",{fill:e,d:"M17 9C15.8954 9 15 8.10457 15 7V3C15 2.44772 15.4477 2 16 2C16.5523 2 17 2.44772 17 3V7H21C21.5523 7 22 7.44772 22 8C22 8.55228 21.5523 9 21 9H17Z"}),a.jsx("path",{fill:e,d:"M17 15C15.8954 15 15 15.8954 15 17V21C15 21.5523 15.4477 22 16 22C16.5523 22 17 21.5523 17 21V17H21C21.5523 17 22 16.5523 22 16C22 15.4477 21.5523 15 21 15H17Z"}),a.jsx("path",{fill:e,d:"M9 17C9 15.8954 8.10457 15 7 15H3C2.44772 15 2 15.4477 2 16C2 16.5523 2.44772 17 3 17H7V21C7 21.5523 7.44772 22 8 22C8.55228 22 9 21.5523 9 21V17Z"})]});case"fontFamily":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:a.jsx("path",{fill:e,d:"M254 52.8C249.3 40.3 237.3 32 224 32s-25.3 8.3-30 20.8L57.8 416 32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-1.8 0 18-48 159.6 0 18 48-1.8 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-25.8 0L254 52.8zM279.8 304l-111.6 0L224 155.1 279.8 304z"})});case"href":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 512",children:a.jsx("path",{fill:e,d:"M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"})});case"image":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:a.jsx("path",{fill:e,d:"M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"})});case"indent":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:a.jsx("path",{fill:e,d:"M0 64C0 46.3 14.3 32 32 32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32zm32 96l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32zM127.8 268.6L25.8 347.9C15.3 356.1 0 348.6 0 335.3L0 176.7c0-13.3 15.3-20.8 25.8-12.6l101.9 79.3c8.2 6.4 8.2 18.9 0 25.3z"})});case"italic":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",children:a.jsx("path",{fill:e,d:"M128 64c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-58.7 0L160 416l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l58.7 0L224 96l-64 0c-17.7 0-32-14.3-32-32z"})});case"left":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:a.jsx("path",{fill:e,d:"M288 64c0 17.7-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32L32 352c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"})});case"more":return a.jsx("svg",{className:"rtf",viewBox:"0 0 20 20",fill:"none",children:a.jsx("path",{fill:e,fillRule:"evenodd",d:"M12 3a2 2 0 10-4 0 2 2 0 004 0zm-2 5a2 2 0 110 4 2 2 0 010-4zm0 7a2 2 0 110 4 2 2 0 010-4z"})});case"numberedList":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:a.jsx("path",{fill:e,d:"M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"})});case"outdent":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:a.jsx("path",{fill:e,d:"M0 64C0 46.3 14.3 32 32 32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32zm32 96l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32zM.2 268.6c-8.2-6.4-8.2-18.9 0-25.3l101.9-79.3c10.5-8.2 25.8-.7 25.8 12.6l0 158.6c0 13.3-15.3 20.8-25.8 12.6L.2 268.6z"})});case"redo":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:a.jsx("path",{fill:e,d:"M463.5 224l8.5 0c13.3 0 24-10.7 24-24l0-128c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2L413.4 96.6c-87.6-86.5-228.7-86.2-315.8 1c-87.5 87.5-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8l119.5 0z"})});case"right":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:a.jsx("path",{fill:e,d:"M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"})});case"size":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:a.jsx("path",{fill:e,d:"M64 128l0-32 64 0 0 320-32 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l128 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0 0-320 64 0 0 32c0 17.7 14.3 32 32 32s32-14.3 32-32l0-48c0-26.5-21.5-48-48-48L160 32 48 32C21.5 32 0 53.5 0 80l0 48c0 17.7 14.3 32 32 32s32-14.3 32-32zM502.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-64 64c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l32 0 0 192-32 0c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l64 64c12.5 12.5 32.8 12.5 45.3 0l64-64c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8l-32 0 0-192 32 0c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-64-64z"})});case"strikethrough":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:a.jsx("path",{fill:e,d:"M161.3 144c3.2-17.2 14-30.1 33.7-38.6c21.1-9 51.8-12.3 88.6-6.5c11.9 1.9 48.8 9.1 60.1 12c17.1 4.5 34.6-5.6 39.2-22.7s-5.6-34.6-22.7-39.2c-14.3-3.8-53.6-11.4-66.6-13.4c-44.7-7-88.3-4.2-123.7 10.9c-36.5 15.6-64.4 44.8-71.8 87.3c-.1 .6-.2 1.1-.2 1.7c-2.8 23.9 .5 45.6 10.1 64.6c4.5 9 10.2 16.9 16.7 23.9L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l448 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-209.9 0-.4-.1-1.1-.3c-36-10.8-65.2-19.6-85.2-33.1c-9.3-6.3-15-12.6-18.2-19.1c-3.1-6.1-5.2-14.6-3.8-27.4zM348.9 337.2c2.7 6.5 4.4 15.8 1.9 30.1c-3 17.6-13.8 30.8-33.9 39.4c-21.1 9-51.7 12.3-88.5 6.5c-18-2.9-49.1-13.5-74.4-22.1c-5.6-1.9-11-3.7-15.9-5.4c-16.8-5.6-34.9 3.5-40.5 20.3s3.5 34.9 20.3 40.5c3.6 1.2 7.9 2.7 12.7 4.3c0 0 0 0 0 0s0 0 0 0c24.9 8.5 63.6 21.7 87.6 25.6c0 0 0 0 0 0l.2 0c44.7 7 88.3 4.2 123.7-10.9c36.5-15.6 64.4-44.8 71.8-87.3c3.6-21 2.7-40.4-3.1-58.1l-75.7 0c7 5.6 11.4 11.2 13.9 17.2z"})});case"subscript":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:a.jsx("path",{fill:e,d:"M32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l15.3 0 89.6 128L47.3 384 32 384c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6l32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-15.3 0L215.1 256l89.6-128 15.3 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0c-10.4 0-20.2 5.1-26.2 13.6L176 200.2 90.2 77.6C84.2 69.1 74.4 64 64 64L32 64zM480 320c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 361.5 404.3 368 416 368l0 80c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0 32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-128z"})});case"superscript":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:a.jsx("path",{fill:e,d:"M480 32c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 73.5 404.3 80 416 80l0 80c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0 32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-128zM32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l15.3 0 89.6 128L47.3 384 32 384c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6l32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-15.3 0L215.1 256l89.6-128 15.3 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0c-10.4 0-20.2 5.1-26.2 13.6L176 200.2 90.2 77.6C84.2 69.1 74.4 64 64 64L32 64z"})});case"table":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:a.jsx("path",{fill:e,d:"M64 256l0-96 160 0 0 96L64 256zm0 64l160 0 0 96L64 416l0-96zm224 96l0-96 160 0 0 96-160 0zM448 256l-160 0 0-96 160 0 0 96zM64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32z"})});case"underline":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:a.jsx("path",{fill:e,d:"M16 64c0-17.7 14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 53 43 96 96 96s96-43 96-96l0-128-16 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 88.4-71.6 160-160 160s-160-71.6-160-160L64 96 48 96C30.3 96 16 81.7 16 64zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32z"})});case"undo":return a.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:a.jsx("path",{fill:e,d:"M48.5 224L40 224c-13.3 0-24-10.7-24-24L16 72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2L98.6 96.6c87.6-86.5 228.7-86.2 315.8 1c87.5 87.5 87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3c-62.2-62.2-162.7-62.5-225.3-1L185 183c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8L48.5 224z"})});default:return null}})()}const Et=({format:t,isActive:e,onMouseDown:r})=>{const{backgroundColor:n,editor:s,imageColor:l}=q(),[c,o]=j.useState(!1),p={backgroundColor:n,color:l},F=h=>{k.toggleBlock(s,t==="bulletList"?"bullet-list":"numbered-list",h),o(!1)};return a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"rtf tool",children:[a.jsx("div",{onMouseDown:h=>{h.preventDefault(),r(t)},children:a.jsx(V,{format:t,imageColor:l})}),e&&a.jsx("div",{className:"rtf tool tool--arrow",style:{color:p.color},onClick:()=>o(!c),children:c?"↑":"↓"})]}),c&&(t==="bulletList"?a.jsx(jt,{selectStyle:p,onChange:F,toggleForm:o}):a.jsx(Ft,{selectStyle:p,onChange:F,toggleForm:o}))]})};function _e({disabled:t=!1,elements:e,elementSelected:r,format:n,isOpen:s,setIsOpen:l,onClick:c}){const{backgroundColor:o,imageColor:p}=q(),F=()=>{l(!s)},h=w=>{c(w),l(!1)};return a.jsxs("div",{className:"rtf dropdown tool",children:[a.jsx("button",{onClick:F,className:"rtf dropdown-toggle",disabled:t,children:a.jsx(V,{format:n,imageColor:p})}),s&&a.jsx("ul",{style:{backgroundColor:o,color:p},className:"rtf dropdown-menu",onMouseLeave:F,children:e.map((w,g)=>a.jsx("li",{style:{backgroundColor:`${r&&w===r?`color-mix(in srgb, ${o} 80%, ${R(o)?"white":"black"})`:o}`},onClick:()=>h(w),children:w},g))})]})}const St=({disabled:t,sizeSelected:e,onSelectSize:r})=>{const[n,s]=j.useState(!1),l=["10px","12px","14px","16px","18px","20px","24px","28px","36px"];return a.jsx(_e,{disabled:t,elements:l,elementSelected:e,format:"size",isOpen:n,setIsOpen:s,onClick:r})},Tt=({fontFamilySelected:t,onSelectFontFamily:e})=>{const[r,n]=j.useState(!1),s=["Arial","Arial Black","Bookman","Comic Sans MS","Courier","Courier New","Garamond","Georgia","Helvetica","Impact","Palatino","Times","Times New Roman","Trebuchet MS","Verdana"];return a.jsx(_e,{elements:s,elementSelected:t,format:"fontFamily",isOpen:r,setIsOpen:n,onClick:e})},Nt=({onClose:t,initialUrl:e="",isOpenInNewTab:r})=>{const[n,s]=j.useState(""),{editor:l,backgroundColor:c,imageColor:o}=q(),[p,F]=j.useState(!1),[h,w]=j.useState(l.selection),g={backgroundColor:c,color:o},E={color:R(c)?"#FFF":"#000"},M={backgroundColor:`color-mix(in srgb, ${c} 80%, ${R(c)?"white":"black"})`,color:E.color},A={backgroundColor:c!=="#800020"?"#800020":"color-mix(in srgb, #800020 80%, black)",color:E.color},N={backgroundColor:c!=="#6c757d"?"#6c757d":"color-mix(in srgb, #6c757d 30%, black)",color:E.color},L=()=>{n&&(k.updateLink(l,n,p),t())},i=()=>{h&&se.ReactEditor.focus(l)},u=()=>{k.removeLink(l),t()};return j.useEffect(()=>{l.selection&&w(l.selection)},[]),j.useEffect(()=>{s(e),F(r)},[e,r]),a.jsxs("div",{onMouseLeave:t,style:g,className:"rtf link-form",children:[a.jsx("input",{className:"rtf",type:"text",placeholder:"Enter URL",value:n,onBlur:i,onChange:b=>s(b.target.value)}),a.jsxs("label",{className:"rtf",children:[a.jsx("input",{className:"rtf",type:"checkbox",checked:p,onBlur:i,onChange:()=>F(!p)}),"Ouvrir dans un nouvel onglet"]}),a.jsxs("div",{className:"rtf link-form-actions",children:[e?a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"rtf",style:M,onClick:L,children:"Modifier"}),a.jsx("button",{className:"rtf",style:A,onClick:u,children:"Supprimer"})]}):a.jsx("button",{className:"rtf",style:M,onClick:L,children:"Valider"}),a.jsx("button",{className:"rtf",style:N,onClick:t,children:"Annuler"})]})]})};/**
181
- * @license
182
- * Copyright (c) 2025 Jahylis
183
- *
184
- * This file is part of ReactTextForge.
185
- *
186
- * ReactTextForge is free software: you can redistribute it and/or modify
187
- * it under the terms of the MIT License as published by
188
- * the Open Source Initiative.
189
- *
190
- * ReactTextForge is distributed in the hope that it will be useful,
191
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
192
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
193
- * MIT License for more details.
194
- *
195
- * You should have received a copy of the MIT License
196
- * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
197
- *
198
- * For any questions or suggestions, please contact: administrateur@nhumeria.fr
199
- */function ve(t){const[e,r]=j.useState(""),[n,s]=j.useState(""),[l,c]=j.useState(!1),[o,p]=j.useState(""),[F,h]=j.useState(""),[w,g]=j.useState("paragraph"),[E,M]=j.useState(!1),[A,N]=j.useState(""),[L,i]=j.useState(!1),u=()=>{i(!L)},b=()=>{M(!E)};return{activeBlock:w,colorMode:n,setColorMode:s,openInNewTab:l,setOpenInNewTab:c,selectedBackgroundColor:F,setSelectedBackgroundColor:h,selectedColor:o,setSelectedColor:p,selectedLanguage:A,setSelectedLanguage:N,selectedLink:e,setSelectedLink:r,showColorPicker:E,showLinkForm:L,setShowLinkForm:i,detectCurrentLanguage:()=>{const{selection:x}=t;if(x){const[S]=d.Editor.nodes(t,{match:T=>T.type==="code"});N(S?S[0].language:null)}},toggleLinkForm:u,toggleColorPicker:b,handleColorChange:x=>{k.applyTextColor(t,x),b()},handleBackgroundColorChange:x=>{k.applyBackgroundTextColor(t,x),b()},handleBlockTypeChange:x=>{k.toggleBlock(t,x),g(x)}}}function At({selectedColor:t,onSelectColor:e,onClose:r}){const[n,s]=j.useState("#ffffff"),{editor:l,backgroundColor:c,borderColor:o,imageColor:p}=q(),F={backgroundColor:c,color:p},h={backgroundColor:`color-mix(in srgb, ${c} 80%, ${R(c)?"white":"black"})`,color:R(c)?"#FFF":"#000"},w={backgroundColor:c!=="#6c757d"?"#6c757d":"color-mix(in srgb, #6c757d 30%, black)",color:R(c)?"#FFF":"#000"},g={default:{picker:{background:c,color:p,border:o}}},E=N=>{se.ReactEditor.focus(l),s(N.hex)},M=()=>{n&&(e(n),r())},A=()=>{e(""),r()};return j.useEffect(()=>{t&&s(t)},[t]),a.jsxs("div",{onMouseLeave:r,className:"rtf color-picker-popup",children:[a.jsx(Ue.SketchPicker,{styles:g,color:n,onChangeComplete:E}),a.jsxs("div",{style:F,className:"rtf link-form-actions",children:[a.jsx("button",{className:"rtf",style:h,onClick:M,disabled:!n,children:"Appliquer"}),a.jsx("button",{className:"rtf",style:w,onClick:A,children:"Annuler"})]})]})}const Lt=()=>{const{editor:t,backgroundColor:e,imageColor:r}=q(),n=k.isBlockquoteActive(t);return a.jsx("button",{onMouseDown:s=>{s.preventDefault(),k.toggleBlockquote(t)},style:{backgroundColor:n?`color-mix(in srgb, ${e} 80%, ${R(e)?"white":"black"})`:""},className:"rtf tool",children:a.jsx(V,{format:"blockquote",imageColor:r})})},Q=({text:t,children:e,position:r="top"})=>{var h;const[n,s]=j.useState(!1),{isDarkTheme:l,backgroundDarkColor:c,imageDarkColor:o}=xe(),p=j.Children.count(e),F=j.Children.map(e,w=>w);return a.jsxs("div",{className:"tooltip-container",style:{display:p===1&&((h=F[0].props.style)==null?void 0:h.display)==="none"?"none":"inline-block"},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[e,n&&a.jsx("div",{style:{backgroundColor:l?"black":c,color:o,borderColor:o},className:`tooltip tooltip--${r} tooltip--visible`,role:"tooltip","aria-label":t,children:t})]})},ze=({activeMarks:t,format:e,isActive:r,tooltip:n})=>{const[s,l]=j.useState(""),{backgroundColor:c,editor:o,imageColor:p}=q(),{activeBlock:F,colorMode:h,setColorMode:w,openInNewTab:g,detectCurrentLanguage:E,handleColorChange:M,handleBackgroundColorChange:A,setOpenInNewTab:N,selectedBackgroundColor:L,setSelectedBackgroundColor:i,selectedColor:u,setSelectedColor:b,selectedLink:v,setSelectedLink:y,showColorPicker:f,showLinkForm:C,setShowLinkForm:x,toggleColorPicker:S,toggleLinkForm:T}=ve(o),P=F==="h1"||F==="h2",K=["left","center","right"],U=D=>{k.applyFontSize(o,D)},I=D=>{k.applyFontFamily(o,D),l(D)},J=()=>{setTimeout(()=>se.ReactEditor.focus(o),0)};return j.useEffect(()=>{E();const{selection:D}=o;if(D){const[O]=d.Editor.nodes(o,{match:G=>G.type==="link"});O?(N(O[0].target==="_blank"),y(O[0].href)):(N(!1),y(""))}},[o.selection]),a.jsx(Q,{text:n,position:"bottom",children:e==="indent"||e==="outdent"?a.jsx("div",{children:a.jsx("button",{title:n,className:"rtf tool",onClick:()=>e==="indent"?k.handleIndent(o):k.handleOutdent(o),disabled:!r,children:a.jsx(V,{format:e,imageColor:r?p:`color-mix(in srgb, ${p} 40%, black)`})})}):e==="fontSize"?a.jsx(St,{disabled:P,onSelectSize:U,sizeSelected:r}):e==="fontFamily"?a.jsx(Tt,{fontFamilySelected:s,onSelectFontFamily:I}):e==="bulletList"||e==="numberedList"?a.jsx("div",{className:"rtf dropdown",children:a.jsx(Et,{format:e,isActive:r,onMouseDown:()=>{e=e==="bulletList"?"bullet-list":"numbered-list",k.toggleBlock(o,e)}})}):e==="href"?a.jsxs("div",{className:"rtf dropdown",children:[a.jsx("button",{onMouseDown:D=>{D.preventDefault(),J(),T()},title:n,className:`rtf tool tool--${r?"active":"inactive"}`,children:a.jsx(V,{format:e,imageColor:p})}),C&&a.jsx(Nt,{onClose:()=>x(!1),initialUrl:v,isOpenInNewTab:g})]}):e==="color"||e==="bgColor"?a.jsxs("div",{className:"rtf dropdown",children:[a.jsx("button",{title:n,onMouseDown:D=>{D.preventDefault(),J(),e==="color"?(b(t[e]),w("color"),S()):(i(t[e]),w("bgColor"),S())},className:`rtf tool tool--${r?"active":"inactive"}`,children:a.jsx(V,{format:e,imageColor:p})}),f&&a.jsx(At,{selectedColor:h==="color"?u:L,onSelectColor:h==="color"?M:A,onClose:S})]}):e==="blockquote"?a.jsx(Lt,{tooltip:n}):a.jsx("button",{onMouseDown:D=>{D.preventDefault(),K.includes(e)?k.toggleAlign(o,e):k.toggleMark(o,e)},title:n,style:{backgroundColor:r?`color-mix(in srgb, ${c} 80%, ${R(c)?"white":"black"})`:""},className:"rtf tool",children:a.jsx(V,{format:e,imageColor:p})})})},$t=j.forwardRef(({tooltip:t},e)=>{const{backgroundColor:r,imageColor:n}=q(),{editor:s}=q(),{activeBlock:l,handleBlockTypeChange:c}=ve(s),o=[{type:"paragraph",name:"Paragraphe"},{type:"h1",name:"Titre"},{type:"h2",name:"Sous-titre"}],p={backgroundColor:r,color:n},F=h=>{const w=h.target.value;c(w)};return a.jsx(Q,{text:t,position:"bottom",children:a.jsx("select",{ref:e,className:"rtf",value:l,onChange:F,style:p,children:o.map(h=>a.jsx("option",{className:"rtf",value:h.type,children:h.name},h.type))})})}),Pe=j.forwardRef((t,e)=>{const[r,n]=j.useState(!1),{backgroundColor:s,editor:l,imageColor:c}=q(),{selectedLanguage:o,setSelectedLanguage:p}=ve(l),F={backgroundColor:s,color:c},h={cs:"C#",cpp:"C++",css:"CSS",diff:"Diff",html:"HTML",java:"Java",javascript:"JavaScript",php:"PHP",python:"Python",ruby:"Ruby",typescript:"TypeScript",xml:"XML"},w=()=>{n(!r)},g=E=>{p(E),k.handleCode(l,E),n(!1)};return a.jsxs("div",{ref:e,className:`rtf dropdown tool ${o&&o!=="init"&&o!==""?"tool--active":""}`,children:[a.jsx("button",{className:"rtf dropdown-toggle",onClick:w,children:a.jsx(V,{format:"blockCode",imageColor:c})}),r&&a.jsxs("ul",{style:F,onMouseLeave:w,className:"rtf dropdown-menu",children:[o&&a.jsx("li",{onClick:()=>g("init"),children:"Réinitialiser"}),Object.keys(h).map(E=>a.jsx("li",{onClick:()=>g(E),style:{cursor:"pointer",padding:"5px 10px",backgroundColor:o&&E===o?`color-mix(in srgb, ${s} 80%, ${R(s)?"white":"black"})`:s},children:h[E]},E))]})]})}),Oe=j.forwardRef((t,e)=>{const{editor:r,imageColor:n}=q();return a.jsxs("div",{className:"rtf tool image-upload-container",ref:e,children:[a.jsx("input",{id:"file-input",type:"file",accept:"image/*",onChange:s=>k.handleFileChange(s,r),className:"rtf hidden-file-input"}),a.jsx("label",{htmlFor:"file-input",className:"rtf image-upload-label",children:a.jsx(V,{format:"image",imageColor:n})})]})}),Mt=({onClose:t})=>{const{editor:e,backgroundColor:r}=q(),[n,s]=j.useState(0),[l,c]=j.useState(0),o={backgroundColor:r,color:R(r)?"#FFF":"#000"},p=(w,g)=>{s(w),c(g)},F=(w,g)=>{k.insertTable(e,w+1,g+1),t()},h=()=>{const w=[];for(let g=0;g<5;g++)for(let E=0;E<5;E++){const M=g<=n&&E<=l;w.push(a.jsx("div",{className:`rtf grid-cell ${M?"hovered":""}`,onMouseEnter:()=>p(g,E),onClick:()=>F(g,E)},`${g}-${E}`))}return w};return a.jsxs("div",{style:o,className:"rtf dropdown-menu table-grid-form",children:[a.jsx("div",{className:"rtf grid-container",children:h()}),a.jsxs("div",{style:o,className:"rtf table-size-indicator",children:["Tableau de ",n+1," lignes x ",l+1," colonnes"]})]})},De=j.forwardRef(({allButtons:t,hiddenButtons:e},r)=>{const{editor:n,imageColor:s}=q(),l=k.isSelectionInTable(n),c=[{name:"deleteTable",alt:"Supprimer le tableau",onClick:k.deleteTable},{name:"addRow",alt:"Ajouter une ligne",onClick:k.addRow},{name:"addColumn",alt:"Ajouter une colonne",onClick:k.addColumn},{name:"deleteRow",alt:"Supprimer une ligne",onClick:k.deleteRow},{name:"deleteColumn",alt:"Supprimer une colonne",onClick:k.deleteColumn}];return a.jsx(a.Fragment,{children:c.map((o,p)=>{var F,h;return a.jsx(Q,{text:t.find(w=>w.format===o.name).tooltip,position:"bottom",children:a.jsx("button",{ref:w=>r.current[o.name]=w,className:"rtf tool",style:{display:e.includes(o.name)?"none":"inline-block"},onClick:()=>o.onClick(n),disabled:!l,children:a.jsx(V,{format:o.name,imageColor:l?k.getTableFromSelection(n)?o.name==="addRow"?k.getTableFromSelection(n).children.length>=5?`color-mix(in srgb, ${s} 40%, ${R(s)?"white":"black"})`:s:o.name==="addColumn"?((F=k.getTableFromSelection(n).children[0])==null?void 0:F.children.length)>=5?`color-mix(in srgb, ${s} 40%, ${R(s)?"white":"black"})`:s:o.name==="deleteColumn"?((h=k.getTableFromSelection(n).children[0])==null?void 0:h.children.length)===1?`color-mix(in srgb, ${s} 40%, ${R(s)?"white":"black"})`:s:o.name==="deleteRow"&&k.getTableFromSelection(n).children.length===1?`color-mix(in srgb, ${s} 40%, ${R(s)?"white":"black"})`:s:s:`color-mix(in srgb, ${s} 40%, ${R(s)?"white":"black"})`})})},p)})})}),_t=({activeMarks:t})=>{const[e,r]=j.useState(!1),[n,s]=j.useState([]),l=j.useRef(null),c=j.useRef({}),{editor:o,imageColor:p,backgroundColor:F}=q(),h=[{format:"blockType",tooltip:"Insérer un bloc de texte"},{format:"bold",tooltip:"Gras (Ctrl+B)"},{format:"underline",tooltip:"Souligné (Ctrl+U)"},{format:"italic",tooltip:"Italique (Ctrl+I)"},{format:"strikethrough",tooltip:"Barré"},{format:"subscript",tooltip:"Indice"},{format:"superscript",tooltip:"Exposant"},{format:"blockquote",tooltip:"Citation"},{format:"color",tooltip:"Couleur du texte"},{format:"bgColor",tooltip:"Couleur de fond"},{format:"fontSize",tooltip:"Taille de texte"},{format:"fontFamily",tooltip:"Police d'écriture"},{format:"href",tooltip:"Insérer un lien (Ctrl+K)"},{format:"bulletList",tooltip:"Liste à puces (Ctrl+L)"},{format:"numberedList",tooltip:"Liste à puces (Ctrl+N)"},{format:"left",tooltip:"Gauche"},{format:"center",tooltip:"Centré"},{format:"right",tooltip:"Droite"},{format:"indent",tooltip:"Indenté"},{format:"outdent",tooltip:"Retrait"},{format:"table",tooltip:"Insérer un tableau"},{format:"deleteTable",tooltip:"Supprimer un tableau"},{format:"addRow",tooltip:"Insérer une ligne"},{format:"addColumn",tooltip:"Insérer une colonne"},{format:"deleteRow",tooltip:"Supprimer une ligne"},{format:"deleteColumn",tooltip:"Supprimer une colonne"},{format:"image",tooltip:"Insérer une image"},{format:"code",tooltip:"Bloc de code (Ctrl+E)"},{format:"undo",tooltip:"Annuler (Ctrl+Z)"},{format:"redo",tooltip:"Rétablir (Ctrl+Y)"}],[w,g]=j.useState(!1),E=["deleteTable","addRow","addColumn","deleteRow","deleteColumn"],M=()=>{g(!w)},A=()=>{document.querySelector(".rtf.toolbar").blur()},N=()=>r(i=>!i),L=()=>{if(l.current){const u=l.current.clientWidth-15;if(978>u){let v=0;const y=[];h.forEach(C=>{const x=c.current[C.format];x&&(v+=(C.format==="blockType"?x.clientWidth:25)+5,v<=u&&y.push(C.format))});const f=h.map(C=>C.format).filter(C=>!y.includes(C));s(f)}else s([])}};return j.useEffect(()=>{if(!l.current)return;const i=new ResizeObserver(()=>{L()});return i.observe(l.current),()=>{i.disconnect()}},[]),a.jsxs("div",{className:"rtf toolbar-container",children:[a.jsxs("div",{className:"rtf toolbar",onClick:A,ref:l,children:[a.jsx($t,{ref:i=>c.current.blockType=i,tooltip:h.find(i=>i.format==="blockType").tooltip}),Object.keys(t).map((i,u)=>a.jsx("div",{className:"rtf",ref:b=>c.current[i]=b,style:{display:n.includes(i)?"none":"inline-block"},children:a.jsx(ze,{activeMarks:t,format:i,isActive:t[i],tooltip:h.find(b=>b.format===i).tooltip})},u)),a.jsxs("div",{className:"rtf dropdown tool",style:{display:n.includes("table")?"none":"flex",padding:n.includes("table")?0:5},children:[a.jsx(Q,{text:h.find(i=>i.format==="table").tooltip,position:"bottom",children:a.jsx("button",{ref:i=>c.current.table=i,onClick:M,className:"rtf dropdown-toggle",children:a.jsx(V,{format:"table",imageColor:p})})}),w&&!n.includes("table")&&a.jsx(Mt,{onClose:M})]}),a.jsx(De,{allButtons:h,hiddenButtons:n,ref:c}),!n.includes("image")&&a.jsx(Q,{text:h.find(i=>i.format==="image").tooltip,position:"bottom",children:a.jsx(Oe,{ref:i=>c.current.image=i})}),!n.includes("code")&&a.jsx(Q,{text:h.find(i=>i.format==="code").tooltip,position:"bottom",children:a.jsx(Pe,{ref:i=>c.current.code=i})}),["undo","redo"].map(i=>!n.includes(i)&&a.jsx(Q,{text:h.find(u=>u.format===i).tooltip,position:"bottom",children:a.jsx("button",{ref:u=>c.current[i]=u,className:"rtf tool",style:{display:n.includes(i)?"none":"inline-block"},onMouseDown:u=>{u.preventDefault(),i==="undo"?o.undo():i==="redo"?o.redo():console.error("Type d'action inconnu !")},children:a.jsx(V,{format:i,imageColor:o.history[i+"s"].length===0?`color-mix(in srgb, ${p} 40%, ${R(p)?"white":"black"})`:p})},i)},i)),n.length>0&&a.jsx(Q,{text:"Voir plus",position:"bottom",children:a.jsx("button",{className:"rtf tool toolbar-more-button",onClick:N,children:a.jsx(V,{format:"more",imageColor:p})})})]}),e&&a.jsx("div",{className:"rtf toolbar-modal",style:{backgroundColor:F},onMouseLeave:()=>r(!1),children:n.map(i=>i==="image"||i==="code"||i==="table"||i==="deleteTable"||i==="addRow"||i==="addColumn"||i==="deleteRow"||i==="deleteColumn"?i==="image"?a.jsx(Oe,{ref:u=>c.current.image=u},i):i==="code"?a.jsx(Pe,{ref:u=>c.current.code=u},i):i==="table"?a.jsx("div",{className:"rtf dropdown tool",children:a.jsx(Q,{text:h.find(u=>u.format===i).tooltip,position:"bottom",children:a.jsx("button",{className:"rtf dropdown-toggle",ref:u=>c.current[i]=u,onClick:M,children:a.jsx(V,{format:i,imageColor:p})})},i)}):E.includes(i)?a.jsx(De,{allButtons:h,hiddenButtons:E.filter(u=>u!==i),ref:c},i):null:a.jsx(ze,{activeMarks:t,format:i,isActive:t[i],tooltip:h.find(u=>u.format===i).tooltip},i))})]})};/**
200
- * @license
201
- * Copyright (c) 2025 Jahylis
202
- *
203
- * This file is part of ReactTextForge.
204
- *
205
- * ReactTextForge is free software: you can redistribute it and/or modify
206
- * it under the terms of the MIT License as published by
207
- * the Open Source Initiative.
208
- *
209
- * ReactTextForge is distributed in the hope that it will be useful,
210
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
211
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
212
- * MIT License for more details.
213
- *
214
- * You should have received a copy of the MIT License
215
- * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
216
- *
217
- * For any questions or suggestions, please contact: administrateur@nhumeria.fr
218
- */const zt=t=>{const e=n=>{if(n.nodeType===Node.TEXT_NODE){const o=n.textContent.trim();return o===""?null:o}if(n.nodeType!==Node.ELEMENT_NODE)return null;const s=Array.from(n.childNodes).map(e).flat().filter(Boolean),l={bold:n.nodeName==="B"||n.nodeName==="STRONG"||n.style.fontWeight==="bold"||n.style.fontWeight==="700",italic:n.nodeName==="I"||n.nodeName==="EM"||n.style.fontStyle==="italic",underline:n.nodeName==="U"||n.style.textDecoration&&n.style.textDecoration.includes("underline"),fontSize:n.style.fontSize||n.nodeName==="FONT"&&n.getAttribute("size"),fontFamily:n.style.fontFamily||n.nodeName==="FONT"&&n.getAttribute("face"),color:n.style.color||n.nodeName==="FONT"&&n.getAttribute("color"),align:n.getAttribute("align")};let c;switch(n.nodeName){case"P":c=z("element",{type:"paragraph",align:l.align,size:l.fontSize},s.length?s:[{text:""}]);break;case"PRE":c=z("element",{type:"code"},s.length?s:[{text:""}]);break;case"UL":c=z("element",{type:"bullet-list"},s);break;case"OL":c=z("element",{type:"numbered-list"},s);break;case"LI":c=z("element",{type:"list-item"},s.length?s:[{text:""}]);break;case"H1":c=z("element",{type:"h1"},s.length?s:[{text:""}]);break;case"H2":case"H3":case"H4":case"H5":case"H6":c=z("element",{type:"h2",align:l.align},s.length?s:[{text:""}]);break;case"BLOCKQUOTE":c=z("element",{type:"blockquote",align:l.align},s.length?s:[{text:""}]);break;case"IMG":c=z("element",{type:"image",url:n.getAttribute("src")});break;case"TABLE":c=z("element",{type:"table"},s);break;case"TR":c=z("element",{type:"table-row"},s);break;case"TD":c=z("element",{type:"table-cell"},s);break;case"A":c=z("element",{type:"link",url:n.getAttribute("href")},s.length?s:[{text:""}]);break;default:c=s.map(o=>typeof o=="string"?z("text",l,o):o).filter(Boolean)}return c};return Array.from(t.childNodes).map(e).flat().filter(Boolean)},Pt=({toggleColor:t,fullScreen:e})=>{const{isDarkTheme:r,toggleTheme:n}=xe();return a.jsxs("label",{className:"rtf toggle-switch",style:{right:e?55:20},children:[a.jsx("input",{className:"rtf",type:"checkbox",checked:r,onChange:n}),a.jsx("span",{className:"rtf slider round",style:{borderColor:t},children:a.jsx("span",{className:"rtf icon",style:{backgroundColor:t},children:a.jsx("span",{children:r?"🌙":"🌞"})})})]})};function Ot({children:t}){const{editor:e,imageColor:r}=q(),n=j.useId(),s=c=>{k.insertParagraphBeforeTable(e,c)},l=()=>{k.insertParagraphAfterTable(e,n)};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"rtf tool table__tool",onClick:()=>s(n),children:a.jsx(V,{format:"enter",imageColor:r})}),a.jsx("table",{className:"rtf","data-table-id":n,children:a.jsx("tbody",{children:t})}),a.jsx("div",{className:"rtf tool table__tool",onClick:l,children:a.jsx(V,{format:"enter",imageColor:r})})]})}const Be=j.createContext({isFullscreen:!1,toggleFullscreen:()=>{}}),Dt=({children:t})=>{const[e,r]=j.useState(!1),n=()=>{r(!e)};return j.useEffect(()=>{const s=()=>{e&&window.innerWidth<768&&r(!1)};return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[e]),a.jsx(Be.Provider,{value:{isFullscreen:e,toggleFullscreen:n},children:t})},Re=()=>j.useContext(Be),Bt=({children:t})=>{const{isFullscreen:e}=Re(),r=j.useRef(null);return j.useEffect(()=>(e?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[e]),a.jsx("div",{ref:r,className:`rtf fullscreen-wrapper ${e?"fullscreen-wrapper--active":""}`,children:t})},Rt=()=>{const{isFullscreen:t,toggleFullscreen:e}=Re(),{backgroundColor:r,imageColor:n}=q();return a.jsx("div",{className:"rtf fullscreen-button",children:a.jsx(Q,{position:"bottom",text:t?"Quitter le mode plein écran (Esc)":"Passer en mode plein écran",children:a.jsx("button",{onClick:e,className:`rtf tool ${t?"tool--active":""}`,style:{backgroundColor:t?`color-mix(in srgb, ${r} 80%, ${R(r)?"white":"black"})`:""},children:a.jsx(V,{format:`fullscreen${t?"Exit":""}`,imageColor:n})})})})};var ye={exports:{}},Ie;function It(){return Ie||(Ie=1,function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
219
- * Prism: Lightweight, robust, elegant syntax highlighting
220
- *
221
- * @license MIT <https://opensource.org/licenses/MIT>
222
- * @author Lea Verou <https://lea.verou.me>
223
- * @namespace
224
- * @public
225
- */var r=function(n){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,l=0,c={},o={manual:n.Prism&&n.Prism.manual,disableWorkerMessageHandler:n.Prism&&n.Prism.disableWorkerMessageHandler,util:{encode:function i(u){return u instanceof p?new p(u.type,i(u.content),u.alias):Array.isArray(u)?u.map(i):u.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(i){return Object.prototype.toString.call(i).slice(8,-1)},objId:function(i){return i.__id||Object.defineProperty(i,"__id",{value:++l}),i.__id},clone:function i(u,b){b=b||{};var v,y;switch(o.util.type(u)){case"Object":if(y=o.util.objId(u),b[y])return b[y];v={},b[y]=v;for(var f in u)u.hasOwnProperty(f)&&(v[f]=i(u[f],b));return v;case"Array":return y=o.util.objId(u),b[y]?b[y]:(v=[],b[y]=v,u.forEach(function(C,x){v[x]=i(C,b)}),v);default:return u}},getLanguage:function(i){for(;i;){var u=s.exec(i.className);if(u)return u[1].toLowerCase();i=i.parentElement}return"none"},setLanguage:function(i,u){i.className=i.className.replace(RegExp(s,"gi"),""),i.classList.add("language-"+u)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(v){var i=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(v.stack)||[])[1];if(i){var u=document.getElementsByTagName("script");for(var b in u)if(u[b].src==i)return u[b]}return null}},isActive:function(i,u,b){for(var v="no-"+u;i;){var y=i.classList;if(y.contains(u))return!0;if(y.contains(v))return!1;i=i.parentElement}return!!b}},languages:{plain:c,plaintext:c,text:c,txt:c,extend:function(i,u){var b=o.util.clone(o.languages[i]);for(var v in u)b[v]=u[v];return b},insertBefore:function(i,u,b,v){v=v||o.languages;var y=v[i],f={};for(var C in y)if(y.hasOwnProperty(C)){if(C==u)for(var x in b)b.hasOwnProperty(x)&&(f[x]=b[x]);b.hasOwnProperty(C)||(f[C]=y[C])}var S=v[i];return v[i]=f,o.languages.DFS(o.languages,function(T,P){P===S&&T!=i&&(this[T]=f)}),f},DFS:function i(u,b,v,y){y=y||{};var f=o.util.objId;for(var C in u)if(u.hasOwnProperty(C)){b.call(u,C,u[C],v||C);var x=u[C],S=o.util.type(x);S==="Object"&&!y[f(x)]?(y[f(x)]=!0,i(x,b,null,y)):S==="Array"&&!y[f(x)]&&(y[f(x)]=!0,i(x,b,C,y))}}},plugins:{},highlightAll:function(i,u){o.highlightAllUnder(document,i,u)},highlightAllUnder:function(i,u,b){var v={callback:b,container:i,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};o.hooks.run("before-highlightall",v),v.elements=Array.prototype.slice.apply(v.container.querySelectorAll(v.selector)),o.hooks.run("before-all-elements-highlight",v);for(var y=0,f;f=v.elements[y++];)o.highlightElement(f,u===!0,v.callback)},highlightElement:function(i,u,b){var v=o.util.getLanguage(i),y=o.languages[v];o.util.setLanguage(i,v);var f=i.parentElement;f&&f.nodeName.toLowerCase()==="pre"&&o.util.setLanguage(f,v);var C=i.textContent,x={element:i,language:v,grammar:y,code:C};function S(P){x.highlightedCode=P,o.hooks.run("before-insert",x),x.element.innerHTML=x.highlightedCode,o.hooks.run("after-highlight",x),o.hooks.run("complete",x),b&&b.call(x.element)}if(o.hooks.run("before-sanity-check",x),f=x.element.parentElement,f&&f.nodeName.toLowerCase()==="pre"&&!f.hasAttribute("tabindex")&&f.setAttribute("tabindex","0"),!x.code){o.hooks.run("complete",x),b&&b.call(x.element);return}if(o.hooks.run("before-highlight",x),!x.grammar){S(o.util.encode(x.code));return}if(u&&n.Worker){var T=new Worker(o.filename);T.onmessage=function(P){S(P.data)},T.postMessage(JSON.stringify({language:x.language,code:x.code,immediateClose:!0}))}else S(o.highlight(x.code,x.grammar,x.language))},highlight:function(i,u,b){var v={code:i,grammar:u,language:b};if(o.hooks.run("before-tokenize",v),!v.grammar)throw new Error('The language "'+v.language+'" has no grammar.');return v.tokens=o.tokenize(v.code,v.grammar),o.hooks.run("after-tokenize",v),p.stringify(o.util.encode(v.tokens),v.language)},tokenize:function(i,u){var b=u.rest;if(b){for(var v in b)u[v]=b[v];delete u.rest}var y=new w;return g(y,y.head,i),h(i,y,u,y.head,0),M(y)},hooks:{all:{},add:function(i,u){var b=o.hooks.all;b[i]=b[i]||[],b[i].push(u)},run:function(i,u){var b=o.hooks.all[i];if(!(!b||!b.length))for(var v=0,y;y=b[v++];)y(u)}},Token:p};n.Prism=o;function p(i,u,b,v){this.type=i,this.content=u,this.alias=b,this.length=(v||"").length|0}p.stringify=function i(u,b){if(typeof u=="string")return u;if(Array.isArray(u)){var v="";return u.forEach(function(S){v+=i(S,b)}),v}var y={type:u.type,content:i(u.content,b),tag:"span",classes:["token",u.type],attributes:{},language:b},f=u.alias;f&&(Array.isArray(f)?Array.prototype.push.apply(y.classes,f):y.classes.push(f)),o.hooks.run("wrap",y);var C="";for(var x in y.attributes)C+=" "+x+'="'+(y.attributes[x]||"").replace(/"/g,"&quot;")+'"';return"<"+y.tag+' class="'+y.classes.join(" ")+'"'+C+">"+y.content+"</"+y.tag+">"};function F(i,u,b,v){i.lastIndex=u;var y=i.exec(b);if(y&&v&&y[1]){var f=y[1].length;y.index+=f,y[0]=y[0].slice(f)}return y}function h(i,u,b,v,y,f){for(var C in b)if(!(!b.hasOwnProperty(C)||!b[C])){var x=b[C];x=Array.isArray(x)?x:[x];for(var S=0;S<x.length;++S){if(f&&f.cause==C+","+S)return;var T=x[S],P=T.inside,K=!!T.lookbehind,U=!!T.greedy,I=T.alias;if(U&&!T.pattern.global){var J=T.pattern.toString().match(/[imsuy]*$/)[0];T.pattern=RegExp(T.pattern.source,J+"g")}for(var D=T.pattern||T,O=v.next,G=y;O!==u.tail&&!(f&&G>=f.reach);G+=O.value.length,O=O.next){var m=O.value;if(u.length>i.length)return;if(!(m instanceof p)){var $=1,_;if(U){if(_=F(D,G,i,K),!_||_.index>=i.length)break;var te=_.index,H=_.index+_[0].length,W=G;for(W+=O.value.length;te>=W;)O=O.next,W+=O.value.length;if(W-=O.value.length,G=W,O.value instanceof p)continue;for(var Z=O;Z!==u.tail&&(W<H||typeof Z.value=="string");Z=Z.next)$++,W+=Z.value.length;$--,m=i.slice(G,W),_.index-=G}else if(_=F(D,0,m,K),!_)continue;var te=_.index,re=_[0],B=m.slice(0,te),ee=m.slice(te+re.length),ne=G+m.length;f&&ne>f.reach&&(f.reach=ne);var oe=O.prev;B&&(oe=g(u,oe,B),G+=B.length),E(u,oe,$);var Wt=new p(C,P?o.tokenize(re,P):re,I,re);if(O=g(u,oe,Wt),ee&&g(u,O,ee),$>1){var we={cause:C+","+S,reach:ne};h(i,u,b,O.prev,G,we),f&&we.reach>f.reach&&(f.reach=we.reach)}}}}}}function w(){var i={value:null,prev:null,next:null},u={value:null,prev:i,next:null};i.next=u,this.head=i,this.tail=u,this.length=0}function g(i,u,b){var v=u.next,y={value:b,prev:u,next:v};return u.next=y,v.prev=y,i.length++,y}function E(i,u,b){for(var v=u.next,y=0;y<b&&v!==i.tail;y++)v=v.next;u.next=v,v.prev=u,i.length-=y}function M(i){for(var u=[],b=i.head.next;b!==i.tail;)u.push(b.value),b=b.next;return u}if(!n.document)return n.addEventListener&&(o.disableWorkerMessageHandler||n.addEventListener("message",function(i){var u=JSON.parse(i.data),b=u.language,v=u.code,y=u.immediateClose;n.postMessage(o.highlight(v,o.languages[b],b)),y&&n.close()},!1)),o;var A=o.util.currentScript();A&&(o.filename=A.src,A.hasAttribute("data-manual")&&(o.manual=!0));function N(){o.manual||o.highlightAll()}if(!o.manual){var L=document.readyState;L==="loading"||L==="interactive"&&A&&A.defer?document.addEventListener("DOMContentLoaded",N):window.requestAnimationFrame?window.requestAnimationFrame(N):window.setTimeout(N,16)}return o}(e);t.exports&&(t.exports=r),typeof Te<"u"&&(Te.Prism=r),r.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},r.languages.markup.tag.inside["attr-value"].inside.entity=r.languages.markup.entity,r.languages.markup.doctype.inside["internal-subset"].inside=r.languages.markup,r.hooks.add("wrap",function(n){n.type==="entity"&&(n.attributes.title=n.content.replace(/&amp;/,"&"))}),Object.defineProperty(r.languages.markup.tag,"addInlined",{value:function(s,l){var c={};c["language-"+l]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:r.languages[l]},c.cdata=/^<!\[CDATA\[|\]\]>$/i;var o={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:c}};o["language-"+l]={pattern:/[\s\S]+/,inside:r.languages[l]};var p={};p[s]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return s}),"i"),lookbehind:!0,greedy:!0,inside:o},r.languages.insertBefore("markup","cdata",p)}}),Object.defineProperty(r.languages.markup.tag,"addAttribute",{value:function(n,s){r.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+n+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[s,"language-"+s],inside:r.languages[s]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),r.languages.html=r.languages.markup,r.languages.mathml=r.languages.markup,r.languages.svg=r.languages.markup,r.languages.xml=r.languages.extend("markup",{}),r.languages.ssml=r.languages.xml,r.languages.atom=r.languages.xml,r.languages.rss=r.languages.xml,function(n){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;n.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},n.languages.css.atrule.inside.rest=n.languages.css;var l=n.languages.markup;l&&(l.tag.addInlined("style","css"),l.tag.addAttribute("style","css"))}(r),r.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},r.languages.javascript=r.languages.extend("clike",{"class-name":[r.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),r.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,r.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:r.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:r.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:r.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:r.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:r.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),r.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:r.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),r.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),r.languages.markup&&(r.languages.markup.tag.addInlined("script","javascript"),r.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),r.languages.js=r.languages.javascript,function(){if(typeof r>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var n="Loading…",s=function(A,N){return"✖ Error "+A+" while fetching file: "+N},l="✖ Error: File does not exist or is empty",c={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},o="data-src-status",p="loading",F="loaded",h="failed",w="pre[data-src]:not(["+o+'="'+F+'"]):not(['+o+'="'+p+'"])';function g(A,N,L){var i=new XMLHttpRequest;i.open("GET",A,!0),i.onreadystatechange=function(){i.readyState==4&&(i.status<400&&i.responseText?N(i.responseText):i.status>=400?L(s(i.status,i.statusText)):L(l))},i.send(null)}function E(A){var N=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(A||"");if(N){var L=Number(N[1]),i=N[2],u=N[3];return i?u?[L,Number(u)]:[L,void 0]:[L,L]}}r.hooks.add("before-highlightall",function(A){A.selector+=", "+w}),r.hooks.add("before-sanity-check",function(A){var N=A.element;if(N.matches(w)){A.code="",N.setAttribute(o,p);var L=N.appendChild(document.createElement("CODE"));L.textContent=n;var i=N.getAttribute("data-src"),u=A.language;if(u==="none"){var b=(/\.(\w+)$/.exec(i)||[,"none"])[1];u=c[b]||b}r.util.setLanguage(L,u),r.util.setLanguage(N,u);var v=r.plugins.autoloader;v&&v.loadLanguages(u),g(i,function(y){N.setAttribute(o,F);var f=E(N.getAttribute("data-range"));if(f){var C=y.split(/\r\n?|\n/g),x=f[0],S=f[1]==null?C.length:f[1];x<0&&(x+=C.length),x=Math.max(0,Math.min(x-1,C.length)),S<0&&(S+=C.length),S=Math.max(0,Math.min(S,C.length)),y=C.slice(x,S).join(`
226
- `),N.hasAttribute("data-start")||N.setAttribute("data-start",String(x+1))}L.textContent=y,r.highlightElement(L)},function(y){N.setAttribute(o,h),L.textContent=y})}}),r.plugins.fileHighlight={highlight:function(N){for(var L=(N||document).querySelectorAll(w),i=0,u;u=L[i++];)r.highlightElement(u)}};var M=!1;r.fileHighlight=function(){M||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),M=!0),r.plugins.fileHighlight.highlight.apply(this,arguments)}}()}(ye)),ye.exports}var Ht=It();const He=pt(Ht);Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript;var qe={},Ve;function qt(){return Ve||(Ve=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),qe}qt(),function(t){var e=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(h){return h=h.replace(/<inner>/g,function(){return e}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+h+")")}var n=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,s=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return n}),l=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+s+l+"(?:"+s+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+s+l+")(?:"+s+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+s+")"+l+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+s+"$"),inside:{"table-header":{pattern:RegExp(n),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(h){["url","bold","italic","strike","code-snippet"].forEach(function(w){h!==w&&(t.languages.markdown[h].inside.content.inside[w]=t.languages.markdown[w])})}),t.hooks.add("after-tokenize",function(h){if(h.language!=="markdown"&&h.language!=="md")return;function w(g){if(!(!g||typeof g=="string"))for(var E=0,M=g.length;E<M;E++){var A=g[E];if(A.type!=="code"){w(A.content);continue}var N=A.content[1],L=A.content[3];if(N&&L&&N.type==="code-language"&&L.type==="code-block"&&typeof N.content=="string"){var i=N.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");i=(/[a-z][\w-]*/i.exec(i)||[""])[0].toLowerCase();var u="language-"+i;L.alias?typeof L.alias=="string"?L.alias=[L.alias,u]:L.alias.push(u):L.alias=[u]}}}w(h.tokens)}),t.hooks.add("wrap",function(h){if(h.type==="code-block"){for(var w="",g=0,E=h.classes.length;g<E;g++){var M=h.classes[g],A=/language-(.+)/.exec(M);if(A){w=A[1];break}}var N=t.languages[w];if(N)h.content=t.highlight(F(h.content),N,w);else if(w&&w!=="none"&&t.plugins.autoloader){var L="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);h.attributes.id=L,t.plugins.autoloader.loadLanguages(w,function(){var i=document.getElementById(L);i&&(i.innerHTML=t.highlight(i.textContent,t.languages[w],w))})}}});var c=RegExp(t.languages.markup.tag.pattern.source,"gi"),o={amp:"&",lt:"<",gt:">",quot:'"'},p=String.fromCodePoint||String.fromCharCode;function F(h){var w=h.replace(c,"");return w=w.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(g,E){if(E=E.toLowerCase(),E[0]==="#"){var M;return E[1]==="x"?M=parseInt(E.slice(2),16):M=Number(E.slice(1)),p(M)}else{var A=o[E];return A||g}}),w}t.languages.md=t.languages.markdown}(Prism),function(t){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+e.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(Prism);const Vt=({value:t,setValue:e,fullScreen:r=!0,showTheme:n=!0,borderColor:s="#ccc",backgroundColor:l="#FFF",imageColor:c="#000",borderDarkColor:o="#1A1A1A",backgroundDarkColor:p="#444444",imageDarkColor:F="#ffffff",toggleColor:h="#2584aa",raccourcis:w=null})=>{const[g]=j.useState(()=>Ze.withDocxDeserializer(We.withHistory(se.withReact(d.createEditor())))),[E,M]=j.useState({bold:!1,underline:!1,italic:!1,strikethrough:!1,subscript:!1,superscript:!1,blockquote:!1,color:"",bgColor:"",fontSize:"",fontFamily:"",href:"",bulletList:!1,numberedList:!1,left:!1,center:!1,right:!1,indent:!1,outdent:!1}),A=j.useMemo(()=>t||[{type:"paragraph",children:[{text:"Un exemple de paragraphe."}]}],[]),N=j.useRef([]),L=([f,C])=>{const x=[];if(!d.Element.isElement(f))return x;const S=d.Node.string(f),T=C[0],P=N.current[T];if(P&&P.text==S)return P.ranges;const K=He.tokenize(S,He.languages.javascript);let U=0;for(const I of K){const J=I.length,D=U+J;typeof I!="string"&&x.push({anchor:{path:C,offset:U},focus:{path:C,offset:D},className:`token ${I.type}`}),U=D}return N.current[T]={text:S,ranges:x},x},i=j.useCallback(f=>{switch(f.element.type){case"code":return a.jsx(bt,{...f});case"bullet-list":case"numbered-list":case"list-item":return a.jsx(yt,{...f});case"h1":return a.jsx("h1",{className:"rtf",...f.attributes,children:f.children});case"h2":return a.jsx("h2",{className:"rtf",...f.attributes,children:f.children});case"blockquote":return a.jsx(wt,{...f});case"image":return a.jsx("img",{className:"rtf",src:f.element.url,alt:"",...f.attributes});case"table":return a.jsx(Ot,{...f});case"table-row":return a.jsx("tr",{className:"rtf",children:f.children});case"table-cell":return a.jsx("td",{className:"rtf",children:f.children});default:return a.jsx(xt,{...f})}},[]),u=j.useCallback(f=>a.jsx(vt,{...f}),[]),b=j.useCallback(()=>{const f=d.Editor.marks(g),C=k.isSelectionInList(g);M(x=>{const S={};for(const T in x)if(T==="bulletList"||T==="numberedList"){const P=T==="bulletList"?"bullet-list":T==="numberedList"?"numbered-list":"";S[T]=C&&k.isBlockActive(g,P)}else if(T==="left"||T==="center"||T==="right")S[T]=k.isAlignActive(g,T);else if(T==="indent"||T==="outdent")S[T]=k.canIndent(g,T);else if(T==="href"){const P=k.isLinkActive(g);let K="";if(P){const U=d.Editor.nodes(g,{match:I=>I.type==="link",mode:"highest"});for(const[I]of U)if(I&&I.href){K=I.href;break}K||console.error("No link node with URL property found")}S[T]=K}else T==="color"?S[T]=(f==null?void 0:f.color)||null:T==="fontSize"?S[T]=(f==null?void 0:f.fontSize)||null:S[T]=(f==null?void 0:f[T])===!0;return S})},[g]),v=async f=>{if(k.isSelectionInCode(g)){const x=f.clipboardData.getData("text/plain");x&&(x.includes(`
227
- `)||x.match(/^\s{2,}/gm))&&(f.preventDefault(),k.insertCodeBlock(g,x));return}const C=f.clipboardData.getData("text/html");if(C){f.preventDefault();const x=new DOMParser().parseFromString(C,"text/html"),S=zt(x.body);g.insertFragment(S)}},y=f=>{f.shiftKey&&k.canIndent(g,"outdent")?(f.preventDefault(),k.handleOutdent(g)):k.canIndent(g,"indent")&&(f.preventDefault(),k.handleIndent(g))};return j.useEffect(()=>{if(w!==null){const f=C=>{Object.keys(w).forEach(x=>{const S=x.split("+"),T=S.pop().toLowerCase(),P=S.map(J=>J.toLowerCase()),K={ctrl:C.ctrlKey,shift:C.shiftKey,alt:C.altKey,meta:C.metaKey},U=P.every(J=>K[J]),I=C.key.toLowerCase()===T;U&&I&&w[x](C)})};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f)}}},[w]),a.jsx(kt,{showTheme:n,borderDarkColor:o,backgroundDarkColor:p,imageDarkColor:F,children:a.jsx(Dt,{children:a.jsx(Bt,{children:a.jsx(Ct,{backgroundColor:l,borderColor:s,editor:g,imageColor:c,children:a.jsxs(se.Slate,{editor:g,initialValue:A,value:A,onChange:f=>{if(b(),g.operations.some(x=>x.type!=="set_selection")){const x=JSON.stringify(f);e(f),localStorage.setItem("content",x)}},children:[a.jsx(_t,{activeMarks:E}),a.jsx(se.Editable,{className:"rtf rtf__editor",decorate:L,renderElement:i,renderLeaf:u,style:{borderColor:s,paddingBottom:n||r?35:10},onPaste:v,onKeyDown:f=>{if(f.key==="Tab"){y(f);return}if(f.key==="Enter"&&!f.ctrlKey&&(k.isSelectionInTable(g)||k.isSelectionInCode(g)||k.isBlockquoteActive(g))&&(f.preventDefault(),g.insertText(`
228
- `)),!!f.ctrlKey)switch(f.key){case"=":{f.preventDefault(),k.toggleBlock(g,"code");break}case"b":{f.preventDefault(),k.toggleMark(g,"bold");break}case"i":{f.preventDefault(),k.toggleMark(g,"italic");break}case"u":{f.preventDefault(),k.toggleMark(g,"underline");break}case"s":{f.preventDefault(),k.toggleMark(g,"strikethrough");break}case"sub":{f.preventDefault(),k.toggleMark(g,"subscript");break}case"sup":{f.preventDefault(),k.toggleMark(g,"superscript");break}case"l":{f.preventDefault(),k.toggleBlock(g,"bulletList");break}case"n":{f.preventDefault(),k.toggleBlock(g,"numberedList");break}case"left":{f.preventDefault(),k.toggleMark(g,"left");break}case"center":{f.preventDefault(),k.toggleMark(g,"center");break}case"right":{f.preventDefault(),k.toggleMark(g,"right");break}case"Enter":{f.preventDefault();const{selection:C}=g;if(C){const[x]=d.Editor.nodes(g,{match:S=>d.Element.isElement(S)&&S.type!=="paragraph"});x&&d.Transforms.insertNodes(g,d.Transforms.insertNodes(g,{type:"paragraph",children:[{text:""}]}))}break}}}}),n&&a.jsx(Pt,{toggleColor:h,fullScreen:r}),r&&a.jsx(Rt,{})]})})})})})};/**
229
- * @license
230
- * Copyright (c) 2025 Jahylis
231
- *
232
- * This file is part of ReactTextForge.
233
- *
234
- * ReactTextForge is free software: you can redistribute it and/or modify
235
- * it under the terms of the MIT License as published by
236
- * the Open Source Initiative.
237
- *
238
- * ReactTextForge is distributed in the hope that it will be useful,
239
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
240
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
241
- * MIT License for more details.
242
- *
243
- * You should have received a copy of the MIT License
244
- * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
245
- *
246
- * For any questions or suggestions, please contact: administrateur@nhumeria.fr
247
- */Y.default=Vt,Y.deserialize=ft,Y.serialize=X,Object.defineProperties(Y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
248
- //# sourceMappingURL=react-text-forge.umd.cjs.map
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("slate"),require("react"),require("slate-react"),require("slate-history"),require("react-color"),require("slate-docx-deserializer")):"function"==typeof define&&define.amd?define(["exports","slate","react","slate-react","slate-history","react-color","slate-docx-deserializer"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactTextForge={},e.Slate,e.React,e.SlateReact,e.SlateHistory,e.ReactColor,e.SlateDocxDeserializer)}(this,function(e,t,r,n,o,a,s){"use strict";
2
+ /*!
3
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
4
+ *
5
+ * Copyright (c) 2014-2017, Jon Schlinkert.
6
+ * Released under the MIT License.
7
+ */function l(e){return"[object Object]"===Object.prototype.toString.call(e)}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e){var t=function(e,t){if("object"!==i(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===i(t)?t:String(t)}function u(e,t,r){return(t=c(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var d=new WeakMap,p=new WeakMap;class g{}class f extends g{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),u(this,"offset",void 0),u(this,"path",void 0);var{offset:t,path:r}=e;this.offset=t,this.path=r}}class m extends g{constructor(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),u(this,"offset",void 0),u(this,"path",void 0);var{offset:t,path:r}=e;this.offset=t,this.path=r}}var h=e=>d.get(e),b=e=>p.get(e);function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach(function(t){u(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var v=new WeakSet,k=e=>{var r=[],n=e=>{if(null!=e){var o=r[r.length-1];if("string"==typeof e){var a={text:e};v.add(a),e=a}if(t.Text.isText(e)){var s=e;t.Text.isText(o)&&v.has(o)&&v.has(s)&&t.Text.equals(o,s,{loose:!0})?o.text+=s.text:r.push(s)}else if(t.Element.isElement(e))r.push(e);else{if(!(e instanceof g))throw new Error("Unexpected hyperscript child object: ".concat(e));var l=r[r.length-1];t.Text.isText(l)||(n(""),l=r[r.length-1]),e instanceof f?((e,t)=>{var r=e.text.length;d.set(e,[r,t])})(l,e):e instanceof m&&((e,t)=>{var r=e.text.length;p.set(e,[r,t])})(l,e)}}};for(var o of e.flat(1/0))n(o);return r};function w(e,t,r){return x(x({},t),{},{children:k(r)})}function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach(function(t){u(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var F,S={anchor:function(e,t,r){return new f(t)},cursor:function(e,t,r){return[new f(t),new m(t)]},editor:(F=t.createEditor,(e,r,n)=>{var o,a=[];for(var s of n)t.Range.isRange(s)?o=s:a.push(s);var l=k(a),i={},c=F();for(var[u,d]of(Object.assign(c,r),c.children=l,t.Node.texts(c))){var p=h(u),g=b(u);if(null!=p){var[f]=p;i.anchor={path:d,offset:f}}if(null!=g){var[m]=g;i.focus={path:d,offset:m}}}if(i.anchor&&!i.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<anchor />`. For collapsed selections, use `<cursor />` instead.");if(!i.anchor&&i.focus)throw new Error("Slate hyperscript ranges must have both `<anchor />` and `<focus />` defined if one is defined, but you only defined `<focus />`. For collapsed selections, use `<cursor />` instead.");return null!=o?c.selection=o:t.Range.isRange(i)&&(c.selection=i),c}),element:w,focus:function(e,t,r){return new m(t)},fragment:function(e,t,r){return k(r)},selection:function(e,t,r){var n=r.find(e=>e instanceof f),o=r.find(e=>e instanceof m);if(!n||null==n.offset||null==n.path)throw new Error("The <selection> hyperscript tag must have an <anchor> tag as a child with `path` and `offset` attributes defined.");if(!o||null==o.offset||null==o.path)throw new Error("The <selection> hyperscript tag must have a <focus> tag as a child with `path` and `offset` attributes defined.");return x({anchor:{offset:n.offset,path:n.path},focus:{offset:o.offset,path:o.path}},t)},text:function(e,r,n){var o=k(n);if(o.length>1)throw new Error("The <text> hyperscript tag must only contain a single node's worth of children.");var[a]=o;if(null==a&&(a={text:""}),!t.Text.isText(a))throw new Error("\n The <text> hyperscript tag can only contain text content as children.");return v.delete(a),Object.assign(a,r),a}},N=e=>function(t,r){for(var n=arguments.length,o=new Array(n>2?n-2:0),a=2;a<n;a++)o[a-2]=arguments[a];var s,i,c,u=e[t];if(!u)throw new Error("No hyperscript creator found for tag: <".concat(t,">"));return null==r&&(r={}),(!1===l(s=r)||void 0!==(i=s.constructor)&&(!1===l(c=i.prototype)||!1===c.hasOwnProperty("isPrototypeOf")))&&(o=[r].concat(o),r={}),u(t,r,o=o.filter(e=>Boolean(e)).flat())},E=e=>{var t={},r=function(){var r=e[n];if("object"!=typeof r)throw new Error("Properties specified for a hyperscript shorthand should be an object, but for the custom element <".concat(n,"> tag you passed: ").concat(r));t[n]=(e,t,n)=>w(0,j(j({},r),t),n)};for(var n in e)r();return t},L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{elements:t={}}=e,r=E(t),n=j(j(j({},S),r),e.creators);return N(n)}();
8
+ /**
9
+ * @license
10
+ * Copyright (c) 2025 Jahylis
11
+ *
12
+ * This file is part of ReactTextForge.
13
+ *
14
+ * ReactTextForge is free software: you can redistribute it and/or modify
15
+ * it under the terms of the MIT License as published by
16
+ * the Open Source Initiative.
17
+ *
18
+ * ReactTextForge is distributed in the hope that it will be useful,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ * MIT License for more details.
22
+ *
23
+ * You should have received a copy of the MIT License
24
+ * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
25
+ *
26
+ * For any questions or suggestions, please contact: administrateur@nhumeria.fr
27
+ */
28
+ const T=e=>e.map(e=>{if(t.Text.isText(e)){let t=e.text;const r=[];if(e.bold&&r.push(`<strong>${t}</strong>`),e.italic&&r.push(`<em>${t}</em>`),e.underline&&r.push(`<u>${t}</u>`),e.strikethrough&&r.push(`<del>${t}</del>`),e.subscript&&!e.superscript&&r.push(`<sub>${t}</sub>`),!e.subscript&&e.superscript&&r.push(`<sup>${t}</sup>`),e.bgColor&&r.push(`<mark style="background-color: ${e.bgColor}">${t}</mark>`),e.href){const n=e.color?` style="color: ${e.color}"`:"",o=e.target?` target="${e.target}"`:"",a=e.rel?` rel="${e.rel}"`:"";return`<a class="rtf" href="${e.href}"${o}${a}${n}>${r.length?r.join(""):t}</a>`}return`<span${` style="color: ${e.color}; font-size: ${e.fontSize}; font-family: ${e.fontFamily}"`}>${r.length>0?r.join(""):t}</span>`}return"paragraph"===e.type?`<p class="rtf">${T(e.children)}</p>`:"code"===e.type?`<pre class="rtf"><code>${T(e.children)}</code></pre>`:"bullet-list"===e.type?`<ul class="rtf">${T(e.children)}</ul>`:"numbered-list"===e.type?`<ol class="rtf">${T(e.children)}</ol>`:"list-item"===e.type?`<li class="rtf">${T(e.children)}</li>`:"h1"===e.type?`<h1 class="rtf">${T(e.children)}</h1>`:"h2"===e.type?`<h2 class="rtf">${T(e.children)}</h2>`:"blockquote"===e.type?`<blockquote class="rtf">${T(e.children)}</blockquote>`:"image"===e.type?`<img class="rtf" src="${e.url}" alt="" />`:"table"===e.type?`<table class="rtf"><tbody>${T(e.children)}</tbody></table>`:"table-row"===e.type?`<tr class="rtf">${T(e.children)}</tr>`:"table-cell"===e.type?`<td class="rtf">${T(e.children)}</td>`:"link"===e.type?`<a class="rtf" href="${e.url}">${T(e.children)}</a>`:""}).join("");
29
+ /**
30
+ * @license
31
+ * Copyright (c) 2025 Jahylis
32
+ *
33
+ * This file is part of ReactTextForge.
34
+ *
35
+ * ReactTextForge is free software: you can redistribute it and/or modify
36
+ * it under the terms of the MIT License as published by
37
+ * the Open Source Initiative.
38
+ *
39
+ * ReactTextForge is distributed in the hope that it will be useful,
40
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
41
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42
+ * MIT License for more details.
43
+ *
44
+ * You should have received a copy of the MIT License
45
+ * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
46
+ *
47
+ * For any questions or suggestions, please contact: administrateur@nhumeria.fr
48
+ */var A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var M,z={exports:{}},_={};var O,P,D={};
49
+ /**
50
+ * @license React
51
+ * react-jsx-runtime.development.js
52
+ *
53
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
54
+ *
55
+ * This source code is licensed under the MIT license found in the
56
+ * LICENSE file in the root directory of this source tree.
57
+ */function B(){return O||(O=1,"production"!==process.env.NODE_ENV&&function(){function e(t){if(null==t)return null;if("function"==typeof t)return t.$$typeof===j?null:t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case g:return"Fragment";case m:return"Profiler";case f:return"StrictMode";case x:return"Suspense";case v:return"SuspenseList";case C:return"Activity"}if("object"==typeof t)switch(t.tag,t.$$typeof){case p:return"Portal";case b:return(t.displayName||"Context")+".Provider";case h:return(t._context.displayName||"Context")+".Consumer";case y:var r=t.render;return(t=t.displayName)||(t=""!==(t=r.displayName||r.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case k:return null!==(r=t.displayName||null)?r:e(t.type)||"Memo";case w:r=t._payload,t=t._init;try{return e(t(r))}catch(n){}}return null}function t(e){return""+e}function n(e){try{t(e);var r=!1}catch(a){r=!0}if(r){var n=(r=console).error,o="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),t(e)}}function o(t){if(t===g)return"<>";if("object"==typeof t&&null!==t&&t.$$typeof===w)return"<...>";try{var r=e(t);return r?"<"+r+">":"<...>"}catch(n){return"<...>"}}function a(){return Error("react-stack-top-frame")}function s(){var t=e(this.type);return L[t]||(L[t]=!0),void 0!==(t=this.props.ref)?t:null}function l(t,r,o,a,l,u,p,g){var f,m=r.children;if(void 0!==m)if(a){if(N(m)){for(a=0;a<m.length;a++)i(m[a]);Object.freeze&&Object.freeze(m)}}else i(m);if(S.call(r,"key")){m=e(t);var h=Object.keys(r).filter(function(e){return"key"!==e});a=0<h.length?"{key: someKey, "+h.join(": ..., ")+": ...}":"{key: someKey}",$[m+a]||(h=0<h.length?"{"+h.join(": ..., ")+": ...}":"{}",$[m+a]=!0)}if(m=null,void 0!==o&&(n(o),m=""+o),function(e){if(S.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(r)&&(n(r.key),m=""+r.key),"key"in r)for(var b in o={},r)"key"!==b&&(o[b]=r[b]);else o=r;return m&&function(e){function t(){c||(c=!0)}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}(o,"function"==typeof t&&(t.displayName||t.name)),function(e,t,r,n,o,a,l,i){return r=a.ref,e={$$typeof:d,type:e,key:t,props:a,_owner:o},null!==(void 0!==r?r:null)?Object.defineProperty(e,"ref",{enumerable:!1,get:s}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:l}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(t,m,u,0,null===(f=F.A)?null:f.getOwner(),o,p,g)}function i(e){"object"==typeof e&&null!==e&&e.$$typeof===d&&e._store&&(e._store.validated=1)}var c,u=r,d=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),b=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),j=Symbol.for("react.client.reference"),F=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,S=Object.prototype.hasOwnProperty,N=Array.isArray,E=console.createTask?console.createTask:function(){return null},L={},T=(u={"react-stack-bottom-frame":function(e){return e()}})["react-stack-bottom-frame"].bind(u,a)(),A=E(o(a)),$={};D.Fragment=g,D.jsx=function(e,t,r,n,a){var s=1e4>F.recentlyCreatedOwnerStacks++;return l(e,t,r,!1,0,a,s?Error("react-stack-top-frame"):T,s?E(o(e)):A)},D.jsxs=function(e,t,r,n,a){var s=1e4>F.recentlyCreatedOwnerStacks++;return l(e,t,r,!0,0,a,s?Error("react-stack-top-frame"):T,s?E(o(e)):A)}}()),D}var R=(P||(P=1,"production"===process.env.NODE_ENV?z.exports=function(){if(M)return _;M=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(t,r,n){var o=null;if(void 0!==n&&(o=""+n),void 0!==r.key&&(o=""+r.key),"key"in r)for(var a in n={},r)"key"!==a&&(n[a]=r[a]);else n=r;return r=n.ref,{$$typeof:e,type:t,key:o,ref:void 0!==r?r:null,props:n}}return _.Fragment=t,_.jsx=r,_.jsxs=r,_}():z.exports=B()),z.exports);const I=({attributes:e,children:t,element:n})=>{const o=r.useRef(null),a=n.language||"plaintext";return R.jsxs("pre",{className:"rtf",...e,children:[R.jsx("div",{spellCheck:"false",className:"rtf code-language",children:a.toUpperCase()}),R.jsx("code",{ref:o,className:`language-${a}`,children:t})]})},H={isMarkActive(e,r){const n=t.Editor.marks(e);return!!n&&!0===n[r]},toggleMark(e,r){H.isMarkActive(e,r)?t.Editor.removeMark(e,r):(t.Editor.addMark(e,r,!0),"subscript"===r?t.Editor.removeMark(e,"superscript"):"superscript"===r&&t.Editor.removeMark(e,"subscript"))},isBlockActive(e,r){const[n]=t.Editor.nodes(e,{match:e=>e.type===r});return!!n},isSelectionInList(e){const[r]=t.Editor.nodes(e,{match:e=>"bullet-list"===e.type||"numbered-list"===e.type});return!!r},getListStyleType(e){const[r]=t.Editor.nodes(e,{match:e=>"list-item"===e.type});return r[0].listStyleType},toggleBlock(e,r,n=null){const o=H.isBlockActive(e,r),a="bullet-list"===r||"numbered-list"===r;if(("h1"===r||"h2"===r)&&t.Editor.removeMark(e,"fontSize"),a&&H.isSelectionInList(e)&&!n)return t.Transforms.unwrapNodes(e,{match:e=>a&&!t.Editor.isEditor(e)&&t.Element.isElement(e)&&("bullet-list"===e.type||"numbered-list"===e.type),split:!0}),void t.Transforms.setNodes(e,{type:"paragraph"});if(n){t.Transforms.setNodes(e,{listStyleType:n});const o=t.Editor.range(e,e.selection).anchor.path;let a=o;3===o.length?a=a.slice(0,1):4===o.length&&(a=a.slice(0,2)),t.Transforms.setNodes(e,{type:r},{at:a})}else{t.Transforms.unwrapNodes(e,{match:e=>a&&!t.Editor.isEditor(e)&&t.Element.isElement(e)&&e.type===r,split:!0});const n={type:o?"paragraph":a?"list-item":r};if(t.Transforms.setNodes(e,n),!o&&a){const n={type:r,children:[]};t.Transforms.wrapNodes(e,n)}}},isAlignActive(e,r){const[n]=t.Editor.nodes(e,{match:e=>e.align===r});return!!n},toggleAlign(e,r){const n=H.isAlignActive(e,r);["alignLeft","center","right"].forEach(r=>{t.Transforms.unsetNodes(e,{align:r})}),n||t.Transforms.setNodes(e,{align:r})},canIndent(e,r){const[n]=t.Editor.nodes(e,{match:e=>"list-item"===e.type});if(n){const[,e]=n;if("indent"===r)return!(e.length>2);if(e.length>2)return!0}return!1},handleIndent(e){const[r]=t.Editor.nodes(e,{match:e=>"list-item"===e.type});if(r){const[,o]=r,a=t.Editor.above(e,{match:e=>["bullet-list","numbered-list"].includes(e.type)})[0].type;try{const r=t.Path.parent(t.Path.parent(o)),n=t.Editor.node(e,r);if(t.Element.isElement(n[0])&&n[0].type===a)return;const s={type:a,children:[]},l=[o[0],o[1]+1];t.Transforms.insertNodes(e,s,{at:l});const i={...t.Editor.node(e,o)[0]},c=[o[0],o[1]+1,0];t.Transforms.insertNodes(e,i,{at:c}),t.Transforms.removeNodes(e,{at:o}),t.Transforms.setNodes(e,{type:"list-item"},{at:[o[0],o[1],0]})}catch(n){}}},handleOutdent(e){const[r]=t.Editor.nodes(e,{match:e=>"list-item"===e.type});if(r){const[,o]=r,a=t.Editor.above(e,{match:e=>["bullet-list","numbered-list"].includes(e.type)})[0].type;try{const r=t.Path.parent(o),n=t.Editor.node(e,r);t.Element.isElement(n)&&n.type===a?t.Transforms.liftNodes(e,{at:o}):t.Transforms.unwrapNodes(e,{at:r,match:e=>t.Element.isElement(e)&&e.type===a,split:!0}),t.Transforms.setNodes(e,{type:"list-item"},{at:o})}catch(n){}}},isLinkActive(e){const{selection:r}=e;if(!r)return!1;const[n]=t.Editor.nodes(e,{match:e=>!t.Editor.isEditor(e)&&t.Node.isNode(e)&&"link"===e.type});return!!n},updateLink(e,r,n){const o=n?"_blank":"_self",a=n?"noopener noreferrer":"";if(H.isLinkActive(e))t.Transforms.setNodes(e,{href:r,target:o,rel:a},{match:e=>"link"===e.type});else{const{selection:n}=e;if(!n||t.Range.isCollapsed(n))return;const s={text:r};t.Range.isCollapsed(n)?t.Transforms.insertNodes(e,{type:"link",href:r,target:o,rel:a,children:[s]}):t.Transforms.setNodes(e,{type:"link",href:r,target:o,rel:a},{match:e=>t.Text.isText(e),split:!0}),t.Transforms.removeNodes(e,{match:e=>"paragraph"===e.type&&0===e.children.length})}},removeLink(e){if(e.selection){const{selection:r}=e,[n,o]=t.Editor.node(e,r);if(n&&"link"===n.type){const r=n.text,a=t.Path.parent(o),s=t.Node.get(e,a);t.Transforms.insertNodes(e,{type:"list-item"!==s.type?s.type:"paragraph",text:r},{at:o,match:e=>t.Text.isText(e)}),t.Transforms.removeNodes(e,{at:o})}}},applyTextColor(e,r){const{selection:n}=e;n&&t.Editor.addMark(e,"color",r)},applyBackgroundTextColor(e,r){const{selection:n}=e;n&&t.Editor.addMark(e,"bgColor",r)},applyFontSize(e,r){const{selection:n}=e;n&&t.Editor.addMark(e,"fontSize",r)},applyFontFamily(e,r){const{selection:n}=e;n&&t.Editor.addMark(e,"fontFamily",r)},isSelectionInCode(e){const[r]=t.Editor.nodes(e,{match:e=>t.Element.isElement(e)&&"code"===e.type});return!!r},getCurrentCodeLanguage(e){const[r]=t.Editor.nodes(e,{match:e=>t.Element.isElement(e)&&"code"===e.type});return r?r[0].language:"plaintext"},handleCode(e,r){const{selection:n}=e;if(n){const[n]=t.Editor.nodes(e,{match:e=>"paragraph"===e.type});if(n){const[,o]=n,a={type:"code",language:r,children:[{text:n[0].children.map(e=>e.text).join("")}]};t.Transforms.setNodes(e,a,{at:o}),t.Transforms.select(e,o)}else{const[n]=t.Editor.nodes(e,{match:e=>"code"===e.type});if(n){const[,o]=n;if("init"===r){const r={type:"paragraph",children:[{text:n[0].children.map(e=>e.text).join("")}]};t.Transforms.setNodes(e,r,{at:o}),t.Transforms.unsetNodes(e,"language",{at:o}),t.Transforms.select(e,o)}else t.Transforms.setNodes(e,{language:r},{at:o}),t.Transforms.select(e,o)}}}},toggleBlockquote(e){const r=this.isBlockquoteActive(e);t.Transforms.setNodes(e,{type:r?"paragraph":"blockquote"},{match:r=>t.Element.isElement(r)&&t.Editor.isBlock(e,r)})},isBlockquoteActive(e){const[r]=t.Editor.nodes(e,{match:e=>t.Element.isElement(e)&&"blockquote"===e.type});return!!r},insertCodeBlock(e,r){const n={type:"code",language:this.getCurrentCodeLanguage(e),children:[{text:r}]},{selection:o}=e;if(!o)return;const[a,s]=t.Editor.parent(e,o);!t.Element.isElement(a)||"paragraph"!==a.type&&"code"!==a.type||""!==t.Node.string(a)||t.Transforms.removeNodes(e,{at:s}),t.Transforms.insertNodes(e,n);const l=t.Editor.end(e,[]);t.Transforms.select(e,l)},insertImage(e,r){const n={type:"image",url:r,children:[{text:""}]};t.Transforms.insertNodes(e,n),t.Transforms.insertNodes(e,{type:"paragraph",children:[{text:""}]})},handleFileChange(e,t){if(e.target.files[0]){const r=e.target.files[0];if(r){const e=new Image,n=new FileReader;n.onload=n=>{"image/svg+xml"===r.type?this.insertImage(t,n.target.result):(e.src=n.target.result,e.onload=()=>{const r=document.createElement("canvas"),n=r.getContext("2d");let o=e.width,a=e.height;o>a?o>800&&(a*=800/o,o=800):a>600&&(o*=600/a,a=600),r.width=o,r.height=a,n.drawImage(e,0,0,o,a);const s=r.toDataURL("image/jpeg");this.insertImage(t,s)},e.onerror=()=>{})},n.onerror=()=>{},n.readAsDataURL(r)}}},insertTable(e,r,n){const o={type:"table",children:Array.from({length:r},()=>({type:"table-row",children:Array.from({length:n},()=>({type:"table-cell",children:[{text:""}]}))}))};t.Transforms.insertNodes(e,o)},isSelectionInTable(e){const[r]=t.Editor.nodes(e,{match:e=>"table"===e.type});return!!r},getTableFromSelection(e){const[r]=t.Editor.nodes(e,{match:e=>"table"===e.type});return r?r[0]:null},addRow(e){var r;const n=H.getTableFromSelection(e);if(n){if(n.children.length>=5)return;const o=null==(r=e.selection)?void 0:r.anchor.path,a=o[1],s={type:"table-row",children:n.children[a].children.map(e=>({...e,children:[{text:""}]}))},l=[o.slice(0,1),a+1];t.Transforms.insertNodes(e,s,{at:l})}},addColumn(e){var r,n;const o=H.getTableFromSelection(e);if(o){if((null==(r=o.children[0])?void 0:r.children.length)>=5)return;const a=null==(n=e.selection)?void 0:n.anchor.path;if(t.Node.get(e,a)){const r=a[a.length-2];void 0!==r&&o.children.forEach((n,o)=>{const s={type:"table-cell",children:[{text:""}]},l=[...a.slice(0,1),o,r+1];l[l.length-1]<=n.children.length&&t.Transforms.insertNodes(e,s,{at:l})})}}},deleteRow(e){var r;const n=H.getTableFromSelection(e);if(n){if(1===n.children.length)return;const o=null==(r=e.selection)?void 0:r.anchor.path,a=o[1];if(void 0!==a){const r=[o[0],a];t.Transforms.removeNodes(e,{at:r})}}},deleteColumn(e){var r,n;const o=H.getTableFromSelection(e);if(o){if(1===(null==(r=o.children[0])?void 0:r.children.length))return;const a=null==(n=e.selection)?void 0:n.anchor.path,s=t.Node.get(e,a),l=a[a.length-1];let i=-1;o.children[l].children.forEach((e,t)=>{e.children[0]===s&&(i=t)}),-1!==i&&o.children.forEach((r,n)=>{if(r.children.length>i){const r=[a[0],n,i];t.Node.get(e,r)&&t.Transforms.removeNodes(e,{at:r})}})}},deleteTable(e){var r;if(H.getTableFromSelection(e)){const n=null==(r=e.selection)?void 0:r.anchor.path.slice(0,1);n.length>0&&t.Transforms.removeNodes(e,{at:n})}},findNearestTable(e){const{selection:r}=e;if(!r)return null;const n=[],o=t.Editor.nodes(e,{match:e=>t.Element.isElement(e)&&"table"===e.type,at:[],mode:"all"});for(const t of o)n.push(t);if(0===n.length)return null;let a=null,s=1/0;for(const[l,i]of n){const e=t.Path.compare(r.anchor.path,i);Math.abs(e)<s&&(s=Math.abs(e),a=[l,i])}return a},insertParagraphBeforeTable(e){const r=this.findNearestTable(e);if(!r)return;const[,n]=r;t.Transforms.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:n})},insertParagraphAfterTable(e){const r=this.findNearestTable(e);if(!r)return;const[,n]=r,o=[n[0]+1];t.Transforms.insertNodes(e,{type:"paragraph",children:[{text:""}]},{at:o})}},q=({attributes:e,children:t,element:r})=>{const n={textAlign:r.align||"left"};return R.jsx("p",{className:"rtf",style:n,...e,children:t})},V=({attributes:e,children:t,leaf:n})=>{let o=[];n.bold&&o.push("strong"),n.italic&&o.push("em"),n.underline&&o.push("u"),n.strikethrough&&o.push("del"),n.subscript&&!n.superscript&&o.push("sub"),!n.subscript&&n.superscript&&o.push("sup"),n.bgColor&&o.push("mark");const a={color:n.color||void 0,fontSize:n.fontSize||void 0,backgroundColor:n.bgColor||void 0,fontFamily:n.fontFamily||void 0},s=e=>{e.stopPropagation(),"_blank"===n.target?(window.open(n.href,n.target,n.rel?{rel:n.rel}:void 0),e.preventDefault()):window.location.href=n.href};return n.href?R.jsx("a",{...e,href:n.href,target:n.target||"_self",rel:n.rel||"noopener noreferrer",style:a,onClick:s,children:0===o.length?t:o.reduceRight((t,n)=>r.createElement(n,{...e},t),t)}):0===o.length?R.jsx("span",{...e,style:a,className:n.className??"",children:t}):o.reduceRight((t,n)=>r.createElement(n,{...e,style:a},t),t)},Z=({attributes:e,children:t,element:r})=>{const n={textAlign:r.align||"left",listStyleType:r.listStyleType||"disc"};switch(r.type){case"bullet-list":return R.jsx("ul",{className:"rtf",style:n,...e,children:t});case"numbered-list":return R.jsx("ol",{className:"rtf",style:n,...e,children:t});case"list-item":return R.jsx("li",{className:"rtf",style:n,...e,children:t});default:return R.jsx("p",{className:"rtf",style:n,...e,children:t})}},W=({attributes:e,children:t})=>R.jsx("blockquote",{className:"rtf",...e,style:{borderLeft:"4px solid #ccc",paddingLeft:"10px",color:"#666",margin:"20px 0"},children:t});
58
+ /**
59
+ * @license
60
+ * Copyright (c) 2025 Jahylis
61
+ *
62
+ * This file is part of ReactTextForge.
63
+ *
64
+ * ReactTextForge is free software: you can redistribute it and/or modify
65
+ * it under the terms of the MIT License as published by
66
+ * the Open Source Initiative.
67
+ *
68
+ * ReactTextForge is distributed in the hope that it will be useful,
69
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
70
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
71
+ * MIT License for more details.
72
+ *
73
+ * You should have received a copy of the MIT License
74
+ * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
75
+ *
76
+ * For any questions or suggestions, please contact: administrateur@nhumeria.fr
77
+ */
78
+ /**
79
+ * @license
80
+ * Copyright (c) 2025 Jahylis
81
+ *
82
+ * This file is part of ReactTextForge.
83
+ *
84
+ * ReactTextForge is free software: you can redistribute it and/or modify
85
+ * it under the terms of the MIT License as published by
86
+ * the Open Source Initiative.
87
+ *
88
+ * ReactTextForge is distributed in the hope that it will be useful,
89
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
90
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
91
+ * MIT License for more details.
92
+ *
93
+ * You should have received a copy of the MIT License
94
+ * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
95
+ *
96
+ * For any questions or suggestions, please contact: administrateur@nhumeria.fr
97
+ */
98
+ function U(e){let t,r,n;if(e.startsWith("#"))e=e.replace(/^#/,""),t=parseInt(e.substring(0,2),16)/255,r=parseInt(e.substring(2,4),16)/255,n=parseInt(e.substring(4,6),16)/255;else{if(!e.startsWith("rgb"))throw new Error("Format de couleur non pris en charge");{const o=e.match(/\d+/g).map(Number);t=o[0]/255,r=o[1]/255,n=o[2]/255}}return.2126*(t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4))<.5}const G=r.createContext({theme:"light",toggleTheme:()=>{},isDarkTheme:!1}),K=({showTheme:e,backgroundDarkColor:t,borderDarkColor:n,imageDarkColor:o,children:a})=>{const[s,l]=r.useState("light");r.useEffect(()=>{if(e){const e=window.matchMedia("(prefers-color-scheme: dark)");l(e.matches?"dark":"light");const t=e=>{l(e.matches?"dark":"light")};return e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}}},[]),r.useEffect(()=>{document.documentElement.setAttribute("data-theme",s)},[s]);return R.jsx(G.Provider,{value:{theme:s,toggleTheme:()=>{l(e=>"light"===e?"dark":"light")},showTheme:e,isDarkTheme:"dark"===s,backgroundDarkColor:t,borderDarkColor:n,imageDarkColor:o},children:a})},X=()=>r.useContext(G),J=r.createContext(),Y=({backgroundColor:e,borderColor:t,imageColor:n,editor:o,children:a})=>{const{showTheme:s,isDarkTheme:l,backgroundDarkColor:i,borderDarkColor:c,imageDarkColor:u}=X(),d=s&&l?i:e,p=s&&l?c:t,g=s&&l?u:n;return r.useEffect(()=>{document.documentElement.style.setProperty("--background-color",d),document.documentElement.style.setProperty("--border-color",p),document.documentElement.style.setProperty("--image-color",g)},[d,p,g]),R.jsx(J.Provider,{value:{backgroundColor:d,borderColor:p,editor:o,imageColor:g},children:R.jsx("div",{className:"rtf react-text-forge",style:{backgroundColor:d,borderColor:p},children:a})})},Q=()=>r.useContext(J),ee=({onChange:e,selectStyle:t,toggleForm:r})=>{const{editor:n}=Q();return R.jsx("ul",{onMouseLeave:()=>r(!1),style:t,className:"rtf dropdown-menu",children:[{value:"disc",label:"Disque"},{value:"circle",label:"Cercle"},{value:"square",label:"Carré"},{value:"'✔'",label:"Check"},{value:"'✘'",label:"Croix"},{value:"'➢'",label:"Petite flèche"},{value:"'➔'",label:"Flèche épaisse"}].map(r=>R.jsx("li",{value:r.value,onClick:()=>e(r.value),style:{backgroundColor:`${r.value===H.getListStyleType(n)?`color-mix(in srgb, ${t.backgroundColor} 80%, ${U(t.backgroundColor)?"white":"black"})`:t.backgroundColor}`},children:r.label},r.value))})},te=({onChange:e,selectStyle:t,toggleForm:r})=>{const{editor:n}=Q();return R.jsx("ul",{onMouseLeave:()=>r(!1),style:t,className:"rtf dropdown-menu",children:[{value:"decimal",label:"Décimal"},{value:"upper-roman",label:"Lettres Romaines majuscules"},{value:"lower-roman",label:"Lettres Romaines minuscules"},{value:"upper-greek",label:"Lettres Grecques majuscules"},{value:"lower-greek",label:"Lettres Grecques minuscules"}].map(r=>R.jsx("li",{value:r.value,onClick:()=>e(r.value),style:{backgroundColor:`${r.value===H.getListStyleType(n)?`color-mix(in srgb, ${t.backgroundColor} 80%, ${U(t.backgroundColor)?"white":"black"})`:t.backgroundColor}`},children:r.label},r.value))})};
99
+ /**
100
+ * @license
101
+ * Copyright (c) 2025 Jahylis
102
+ *
103
+ * This file is part of ReactTextForge.
104
+ *
105
+ * ReactTextForge is free software: you can redistribute it and/or modify
106
+ * it under the terms of the MIT License as published by
107
+ * the Open Source Initiative.
108
+ *
109
+ * ReactTextForge is distributed in the hope that it will be useful,
110
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
111
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
112
+ * MIT License for more details.
113
+ *
114
+ * You should have received a copy of the MIT License
115
+ * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
116
+ *
117
+ * For any questions or suggestions, please contact: administrateur@nhumeria.fr
118
+ */
119
+ function re({format:e,imageColor:t}){return(()=>{switch(e){case"addColumn":return R.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("g",{id:"Edit / Add_Column",children:R.jsx("path",{id:"Vector",d:"M5 17H8M8 17H11M8 17V14M8 17V20M14 21H15C16.1046 21 17 20.1046 17 19V5C17 3.89543 16.1046 3 15 3H13C11.8954 3 11 3.89543 11 5V11",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"addRow":return R.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("g",{id:"Edit / Add_Row",children:R.jsx("path",{id:"Vector",d:"M3 14V15C3 16.1046 3.89543 17 5 17L19 17C20.1046 17 21 16.1046 21 15L21 13C21 11.8954 20.1046 11 19 11H13M10 8H7M7 8H4M7 8V5M7 8V11",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"bgColor":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M86.6 9.4C74.1-3.1 53.9-3.1 41.4 9.4s-12.5 32.8 0 45.3L122.7 136 30.6 228.1c-37.5 37.5-37.5 98.3 0 135.8L148.1 481.4c37.5 37.5 98.3 37.5 135.8 0L474.3 290.9c28.1-28.1 28.1-73.7 0-101.8L322.9 37.7c-28.1-28.1-73.7-28.1-101.8 0L168 90.7 86.6 9.4zM168 181.3l49.4 49.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L213.3 136l53.1-53.1c3.1-3.1 8.2-3.1 11.3 0L429.1 234.3c3.1 3.1 3.1 8.2 0 11.3L386.7 288 67.5 288c1.4-5.4 4.2-10.4 8.4-14.6L168 181.3z"})});case"blockCode":return R.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none",children:R.jsx("path",{fill:t,fillRule:"evenodd",d:"M2 6a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V6zm5 1a1 1 0 0 0 0 2h5a1 1 0 1 0 0-2H7zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2h-2zm-8 4a1 1 0 1 0 0 2h1a1 1 0 1 0 0-2H7zm4 0a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6zm-4 4a1 1 0 1 0 0 2h5a1 1 0 1 0 0-2H7zm8 0a1 1 0 1 0 0 2h2a1 1 0 1 0 0-2h-2z",clipRule:"evenodd"})});case"blockquote":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M448 296c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72zm-256 0c0 66.3-53.7 120-120 120l-8 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l8 0c30.9 0 56-25.1 56-56l0-8-64 0c-35.3 0-64-28.7-64-64l0-64c0-35.3 28.7-64 64-64l64 0c35.3 0 64 28.7 64 64l0 32 0 32 0 72z"})});case"bold":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",children:R.jsx("path",{fill:t,d:"M0 64C0 46.3 14.3 32 32 32l48 0 16 0 128 0c70.7 0 128 57.3 128 128c0 31.3-11.3 60.1-30 82.3c37.1 22.4 62 63.1 62 109.7c0 70.7-57.3 128-128 128L96 480l-16 0-48 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l16 0 0-160L48 96 32 96C14.3 96 0 81.7 0 64zM224 224c35.3 0 64-28.7 64-64s-28.7-64-64-64L112 96l0 128 112 0zM112 288l0 128 144 0c35.3 0 64-28.7 64-64s-28.7-64-64-64l-32 0-112 0z"})});case"bulletList":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M64 144a48 48 0 1 0 0-96 48 48 0 1 0 0 96zM192 64c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 64zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zm0 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l288 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-288 0zM64 464a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm48-208a48 48 0 1 0 -96 0 48 48 0 1 0 96 0z"})});case"center":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M352 64c0-17.7-14.3-32-32-32L128 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32zm96 128c0-17.7-14.3-32-32-32L32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l384 0c17.7 0 32-14.3 32-32zM0 448c0 17.7 14.3 32 32 32l384 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 416c-17.7 0-32 14.3-32 32zM352 320c0-17.7-14.3-32-32-32l-192 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l192 0c17.7 0 32-14.3 32-32z"})});case"color":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M512 256c0 .9 0 1.8 0 2.7c-.4 36.5-33.6 61.3-70.1 61.3L344 320c-26.5 0-48 21.5-48 48c0 3.4 .4 6.7 1 9.9c2.1 10.2 6.5 20 10.8 29.9c6.1 13.8 12.1 27.5 12.1 42c0 31.8-21.6 60.7-53.4 62c-3.5 .1-7 .2-10.6 .2C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256zM128 288a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm0-96a32 32 0 1 0 0-64 32 32 0 1 0 0 64zM288 96a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm96 96a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"})});case"deleteColumn":return R.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("g",{id:"Edit / Delete_Column",children:R.jsx("path",{id:"Vector",d:"M10 21H9C7.89543 21 7 20.1046 7 19V5C7 3.89543 7.89543 3 9 3H11C12.1046 3 13 3.89543 13 5V11M19 16H13",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"deleteRow":return R.jsx("svg",{className:"rtf",width:"800px",height:"800px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("g",{id:"Edit / Delete_Row",children:R.jsx("path",{id:"Vector",d:"M14 16H20M21 10V9C21 7.89543 20.1046 7 19 7H5C3.89543 7 3 7.89543 3 9V11C3 12.1046 3.89543 13 5 13H11",stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})});case"deleteTable":return R.jsx("svg",{className:"rtf",fill:t,width:"800px",height:"800px",viewBox:"0 0 1920 1920",xmlns:"http://www.w3.org/2000/svg",children:R.jsx("path",{d:"M1800 1740c0 33-26.88 60-60 60H180c-33.12 0-60-27-60-60V180c0-33.12 26.88-60 60-60h1560c33.12 0 60 26.88 60 60v1560ZM1740 0H180C80.76 0 0 80.76 0 180v1560c0 99.24 80.76 180 180 180h1560c99.24 0 180-80.76 180-180V180c0-99.24-80.76-180-180-180Zm-235.08 245.388L960 790.308l-544.92-544.92-169.68 169.68 544.92 544.92-544.92 544.92 169.68 169.68L960 1129.668l544.92 544.92 169.68-169.68-544.92-544.92 544.92-544.92-169.68-169.68Z",fillRule:"evenodd"})});case"enter":return R.jsx("svg",{className:"rtf",viewBox:"0 0 24 24",fill:"none",children:R.jsx("path",{stroke:t,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",d:"M20 7V8.2C20 9.88016 20 10.7202 19.673 11.362C19.3854 11.9265 18.9265 12.3854 18.362 12.673C17.7202 13 16.8802 13 15.2 13H4M4 13L8 9M4 13L8 17"})});case"fullscreen":return R.jsxs("svg",{className:"rtf",viewBox:"0 0 24 24",fill:"none",children:[R.jsx("path",{fill:t,d:"M4 2C2.89543 2 2 2.89543 2 4V8C2 8.55228 2.44772 9 3 9C3.55228 9 4 8.55228 4 8V4H8C8.55228 4 9 3.55228 9 3C9 2.44772 8.55228 2 8 2H4Z"}),R.jsx("path",{fill:t,d:"M20 2C21.1046 2 22 2.89543 22 4V8C22 8.55228 21.5523 9 21 9C20.4477 9 20 8.55228 20 8V4H16C15.4477 4 15 3.55228 15 3C15 2.44772 15.4477 2 16 2H20Z"}),R.jsx("path",{fill:t,d:"M20 22C21.1046 22 22 21.1046 22 20V16C22 15.4477 21.5523 15 21 15C20.4477 15 20 15.4477 20 16V20H16C15.4477 20 15 20.4477 15 21C15 21.5523 15.4477 22 16 22H20Z"}),R.jsx("path",{fill:t,d:"M2 20C2 21.1046 2.89543 22 4 22H8C8.55228 22 9 21.5523 9 21C9 20.4477 8.55228 20 8 20H4V16C4 15.4477 3.55228 15 3 15C2.44772 15 2 15.4477 2 16V20Z"})]});case"fullscreenExit":return R.jsxs("svg",{className:"rtf",viewBox:"0 0 24 24",fill:"none",children:[R.jsx("path",{fill:t,d:"M7 9C8.10457 9 9 8.10457 9 7V3C9 2.44772 8.55228 2 8 2C7.44772 2 7 2.44772 7 3V7H3C2.44772 7 2 7.44772 2 8C2 8.55228 2.44772 9 3 9H7Z"}),R.jsx("path",{fill:t,d:"M17 9C15.8954 9 15 8.10457 15 7V3C15 2.44772 15.4477 2 16 2C16.5523 2 17 2.44772 17 3V7H21C21.5523 7 22 7.44772 22 8C22 8.55228 21.5523 9 21 9H17Z"}),R.jsx("path",{fill:t,d:"M17 15C15.8954 15 15 15.8954 15 17V21C15 21.5523 15.4477 22 16 22C16.5523 22 17 21.5523 17 21V17H21C21.5523 17 22 16.5523 22 16C22 15.4477 21.5523 15 21 15H17Z"}),R.jsx("path",{fill:t,d:"M9 17C9 15.8954 8.10457 15 7 15H3C2.44772 15 2 15.4477 2 16C2 16.5523 2.44772 17 3 17H7V21C7 21.5523 7.44772 22 8 22C8.55228 22 9 21.5523 9 21V17Z"})]});case"fontFamily":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M254 52.8C249.3 40.3 237.3 32 224 32s-25.3 8.3-30 20.8L57.8 416 32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-1.8 0 18-48 159.6 0 18 48-1.8 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-25.8 0L254 52.8zM279.8 304l-111.6 0L224 155.1 279.8 304z"})});case"href":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 512",children:R.jsx("path",{fill:t,d:"M579.8 267.7c56.5-56.5 56.5-148 0-204.5c-50-50-128.8-56.5-186.3-15.4l-1.6 1.1c-14.4 10.3-17.7 30.3-7.4 44.6s30.3 17.7 44.6 7.4l1.6-1.1c32.1-22.9 76-19.3 103.8 8.6c31.5 31.5 31.5 82.5 0 114L422.3 334.8c-31.5 31.5-82.5 31.5-114 0c-27.9-27.9-31.5-71.8-8.6-103.8l1.1-1.6c10.3-14.4 6.9-34.4-7.4-44.6s-34.4-6.9-44.6 7.4l-1.1 1.6C206.5 251.2 213 330 263 380c56.5 56.5 148 56.5 204.5 0L579.8 267.7zM60.2 244.3c-56.5 56.5-56.5 148 0 204.5c50 50 128.8 56.5 186.3 15.4l1.6-1.1c14.4-10.3 17.7-30.3 7.4-44.6s-30.3-17.7-44.6-7.4l-1.6 1.1c-32.1 22.9-76 19.3-103.8-8.6C74 372 74 321 105.5 289.5L217.7 177.2c31.5-31.5 82.5-31.5 114 0c27.9 27.9 31.5 71.8 8.6 103.9l-1.1 1.6c-10.3 14.4-6.9 34.4 7.4 44.6s34.4 6.9 44.6-7.4l1.1-1.6C433.5 260.8 427 182 377 132c-56.5-56.5-148-56.5-204.5 0L60.2 244.3z"})});case"image":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M0 96C0 60.7 28.7 32 64 32l384 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6l96 0 32 0 208 0c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"})});case"indent":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M0 64C0 46.3 14.3 32 32 32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32zm32 96l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32zM127.8 268.6L25.8 347.9C15.3 356.1 0 348.6 0 335.3L0 176.7c0-13.3 15.3-20.8 25.8-12.6l101.9 79.3c8.2 6.4 8.2 18.9 0 25.3z"})});case"italic":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 384 512",children:R.jsx("path",{fill:t,d:"M128 64c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-58.7 0L160 416l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l58.7 0L224 96l-64 0c-17.7 0-32-14.3-32-32z"})});case"left":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M288 64c0 17.7-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64S14.3 32 32 32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32L32 352c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"})});case"more":return R.jsx("svg",{className:"rtf",viewBox:"0 0 20 20",fill:"none",children:R.jsx("path",{fill:t,fillRule:"evenodd",d:"M12 3a2 2 0 10-4 0 2 2 0 004 0zm-2 5a2 2 0 110 4 2 2 0 010-4zm0 7a2 2 0 110 4 2 2 0 010-4z"})});case"numberedList":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M24 56c0-13.3 10.7-24 24-24l32 0c13.3 0 24 10.7 24 24l0 120 16 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-80 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l16 0 0-96-8 0C34.7 80 24 69.3 24 56zM86.7 341.2c-6.5-7.4-18.3-6.9-24 1.2L51.5 357.9c-7.7 10.8-22.7 13.3-33.5 5.6s-13.3-22.7-5.6-33.5l11.1-15.6c23.7-33.2 72.3-35.6 99.2-4.9c21.3 24.4 20.8 60.9-1.1 84.7L86.8 432l33.2 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-88 0c-9.5 0-18.2-5.6-22-14.4s-2.1-18.9 4.3-25.9l72-78c5.3-5.8 5.4-14.6 .3-20.5zM224 64l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zm0 160l256 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-256 0c-17.7 0-32-14.3-32-32s14.3-32 32-32z"})});case"outdent":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M0 64C0 46.3 14.3 32 32 32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 96C14.3 96 0 81.7 0 64zM192 192c0-17.7 14.3-32 32-32l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32zm32 96l192 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32s14.3-32 32-32zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32zM.2 268.6c-8.2-6.4-8.2-18.9 0-25.3l101.9-79.3c10.5-8.2 25.8-.7 25.8 12.6l0 158.6c0 13.3-15.3 20.8-25.8 12.6L.2 268.6z"})});case"redo":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M463.5 224l8.5 0c13.3 0 24-10.7 24-24l0-128c0-9.7-5.8-18.5-14.8-22.2s-19.3-1.7-26.2 5.2L413.4 96.6c-87.6-86.5-228.7-86.2-315.8 1c-87.5 87.5-87.5 229.3 0 316.8s229.3 87.5 316.8 0c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0c-62.5 62.5-163.8 62.5-226.3 0s-62.5-163.8 0-226.3c62.2-62.2 162.7-62.5 225.3-1L327 183c-6.9 6.9-8.9 17.2-5.2 26.2s12.5 14.8 22.2 14.8l119.5 0z"})});case"right":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M448 64c0 17.7-14.3 32-32 32L192 96c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zm0 256c0 17.7-14.3 32-32 32l-224 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l224 0c17.7 0 32 14.3 32 32zM0 192c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 224c-17.7 0-32-14.3-32-32zM448 448c0 17.7-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"})});case"size":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:R.jsx("path",{fill:t,d:"M64 128l0-32 64 0 0 320-32 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l128 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0 0-320 64 0 0 32c0 17.7 14.3 32 32 32s32-14.3 32-32l0-48c0-26.5-21.5-48-48-48L160 32 48 32C21.5 32 0 53.5 0 80l0 48c0 17.7 14.3 32 32 32s32-14.3 32-32zM502.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-64 64c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l32 0 0 192-32 0c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l64 64c12.5 12.5 32.8 12.5 45.3 0l64-64c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8l-32 0 0-192 32 0c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-64-64z"})});case"strikethrough":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M161.3 144c3.2-17.2 14-30.1 33.7-38.6c21.1-9 51.8-12.3 88.6-6.5c11.9 1.9 48.8 9.1 60.1 12c17.1 4.5 34.6-5.6 39.2-22.7s-5.6-34.6-22.7-39.2c-14.3-3.8-53.6-11.4-66.6-13.4c-44.7-7-88.3-4.2-123.7 10.9c-36.5 15.6-64.4 44.8-71.8 87.3c-.1 .6-.2 1.1-.2 1.7c-2.8 23.9 .5 45.6 10.1 64.6c4.5 9 10.2 16.9 16.7 23.9L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l448 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-209.9 0-.4-.1-1.1-.3c-36-10.8-65.2-19.6-85.2-33.1c-9.3-6.3-15-12.6-18.2-19.1c-3.1-6.1-5.2-14.6-3.8-27.4zM348.9 337.2c2.7 6.5 4.4 15.8 1.9 30.1c-3 17.6-13.8 30.8-33.9 39.4c-21.1 9-51.7 12.3-88.5 6.5c-18-2.9-49.1-13.5-74.4-22.1c-5.6-1.9-11-3.7-15.9-5.4c-16.8-5.6-34.9 3.5-40.5 20.3s3.5 34.9 20.3 40.5c3.6 1.2 7.9 2.7 12.7 4.3c0 0 0 0 0 0s0 0 0 0c24.9 8.5 63.6 21.7 87.6 25.6c0 0 0 0 0 0l.2 0c44.7 7 88.3 4.2 123.7-10.9c36.5-15.6 64.4-44.8 71.8-87.3c3.6-21 2.7-40.4-3.1-58.1l-75.7 0c7 5.6 11.4 11.2 13.9 17.2z"})});case"subscript":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l15.3 0 89.6 128L47.3 384 32 384c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6l32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-15.3 0L215.1 256l89.6-128 15.3 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0c-10.4 0-20.2 5.1-26.2 13.6L176 200.2 90.2 77.6C84.2 69.1 74.4 64 64 64L32 64zM480 320c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 361.5 404.3 368 416 368l0 80c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0 32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-128z"})});case"superscript":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M480 32c0-11.1-5.7-21.4-15.2-27.2s-21.2-6.4-31.1-1.4l-32 16c-15.8 7.9-22.2 27.1-14.3 42.9C393 73.5 404.3 80 416 80l0 80c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0 32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l0-128zM32 64C14.3 64 0 78.3 0 96s14.3 32 32 32l15.3 0 89.6 128L47.3 384 32 384c-17.7 0-32 14.3-32 32s14.3 32 32 32l32 0c10.4 0 20.2-5.1 26.2-13.6L176 311.8l85.8 122.6c6 8.6 15.8 13.6 26.2 13.6l32 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-15.3 0L215.1 256l89.6-128 15.3 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-32 0c-10.4 0-20.2 5.1-26.2 13.6L176 200.2 90.2 77.6C84.2 69.1 74.4 64 64 64L32 64z"})});case"table":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M64 256l0-96 160 0 0 96L64 256zm0 64l160 0 0 96L64 416l0-96zm224 96l0-96 160 0 0 96-160 0zM448 256l-160 0 0-96 160 0 0 96zM64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32z"})});case"underline":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",children:R.jsx("path",{fill:t,d:"M16 64c0-17.7 14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 53 43 96 96 96s96-43 96-96l0-128-16 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l96 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-16 0 0 128c0 88.4-71.6 160-160 160s-160-71.6-160-160L64 96 48 96C30.3 96 16 81.7 16 64zM0 448c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 480c-17.7 0-32-14.3-32-32z"})});case"undo":return R.jsx("svg",{className:"rtf",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",children:R.jsx("path",{fill:t,d:"M48.5 224L40 224c-13.3 0-24-10.7-24-24L16 72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2L98.6 96.6c87.6-86.5 228.7-86.2 315.8 1c87.5 87.5 87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3c-62.2-62.2-162.7-62.5-225.3-1L185 183c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8L48.5 224z"})});default:return null}})()}const ne=({format:e,isActive:t,onMouseDown:n})=>{const{backgroundColor:o,editor:a,imageColor:s}=Q(),[l,i]=r.useState(!1),c={backgroundColor:o,color:s},u=t=>{H.toggleBlock(a,"bulletList"===e?"bullet-list":"numbered-list",t),i(!1)};return R.jsxs(R.Fragment,{children:[R.jsxs("button",{className:"rtf tool",children:[R.jsx("div",{onMouseDown:t=>{t.preventDefault(),n(e)},children:R.jsx(re,{format:e,imageColor:s})}),t&&R.jsx("div",{className:"rtf tool tool--arrow",style:{color:c.color},onClick:()=>i(!l),children:l?"↑":"↓"})]}),l&&("bulletList"===e?R.jsx(ee,{selectStyle:c,onChange:u,toggleForm:i}):R.jsx(te,{selectStyle:c,onChange:u,toggleForm:i}))]})};function oe({disabled:e=!1,elements:t,elementSelected:r,format:n,isOpen:o,setIsOpen:a,onClick:s}){const{backgroundColor:l,imageColor:i}=Q(),c=()=>{a(!o)};return R.jsxs("div",{className:"rtf dropdown tool",children:[R.jsx("button",{onClick:c,className:"rtf dropdown-toggle",disabled:e,children:R.jsx(re,{format:n,imageColor:i})}),o&&R.jsx("ul",{style:{backgroundColor:l,color:i},className:"rtf dropdown-menu",onMouseLeave:c,children:t.map((e,t)=>R.jsx("li",{style:{backgroundColor:`${r&&e===r?`color-mix(in srgb, ${l} 80%, ${U(l)?"white":"black"})`:l}`},onClick:()=>(e=>{s(e),a(!1)})(e),children:e},t))})]})}const ae=({disabled:e,sizeSelected:t,onSelectSize:n})=>{const[o,a]=r.useState(!1);return R.jsx(oe,{disabled:e,elements:["10px","12px","14px","16px","18px","20px","24px","28px","36px"],elementSelected:t,format:"size",isOpen:o,setIsOpen:a,onClick:n})},se=({fontFamilySelected:e,onSelectFontFamily:t})=>{const[n,o]=r.useState(!1);return R.jsx(oe,{elements:["Arial","Arial Black","Bookman","Comic Sans MS","Courier","Courier New","Garamond","Georgia","Helvetica","Impact","Palatino","Times","Times New Roman","Trebuchet MS","Verdana"],elementSelected:e,format:"fontFamily",isOpen:n,setIsOpen:o,onClick:t})},le=({onClose:e,initialUrl:t="",isOpenInNewTab:o})=>{const[a,s]=r.useState(""),{editor:l,backgroundColor:i,imageColor:c}=Q(),[u,d]=r.useState(!1),[p,g]=r.useState(l.selection),f={backgroundColor:i,color:c},m={color:U(i)?"#FFF":"#000"},h={backgroundColor:`color-mix(in srgb, ${i} 80%, ${U(i)?"white":"black"})`,color:m.color},b={backgroundColor:"#800020"!==i?"#800020":"color-mix(in srgb, #800020 80%, black)",color:m.color},y={backgroundColor:"#6c757d"!==i?"#6c757d":"color-mix(in srgb, #6c757d 30%, black)",color:m.color},x=()=>{a&&(H.updateLink(l,a,u),e())},v=()=>{p&&n.ReactEditor.focus(l)};return r.useEffect(()=>{l.selection&&g(l.selection)},[]),r.useEffect(()=>{s(t),d(o)},[t,o]),R.jsxs("div",{onMouseLeave:e,style:f,className:"rtf link-form",children:[R.jsx("input",{className:"rtf",type:"text",placeholder:"Enter URL",value:a,onBlur:v,onChange:e=>s(e.target.value)}),R.jsxs("label",{className:"rtf",children:[R.jsx("input",{className:"rtf",type:"checkbox",checked:u,onBlur:v,onChange:()=>d(!u)}),"Ouvrir dans un nouvel onglet"]}),R.jsxs("div",{className:"rtf link-form-actions",children:[t?R.jsxs(R.Fragment,{children:[R.jsx("button",{className:"rtf",style:h,onClick:x,children:"Modifier"}),R.jsx("button",{className:"rtf",style:b,onClick:()=>{H.removeLink(l),e()},children:"Supprimer"})]}):R.jsx("button",{className:"rtf",style:h,onClick:x,children:"Valider"}),R.jsx("button",{className:"rtf",style:y,onClick:e,children:"Annuler"})]})]})};
120
+ /**
121
+ * @license
122
+ * Copyright (c) 2025 Jahylis
123
+ *
124
+ * This file is part of ReactTextForge.
125
+ *
126
+ * ReactTextForge is free software: you can redistribute it and/or modify
127
+ * it under the terms of the MIT License as published by
128
+ * the Open Source Initiative.
129
+ *
130
+ * ReactTextForge is distributed in the hope that it will be useful,
131
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
132
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
133
+ * MIT License for more details.
134
+ *
135
+ * You should have received a copy of the MIT License
136
+ * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
137
+ *
138
+ * For any questions or suggestions, please contact: administrateur@nhumeria.fr
139
+ */
140
+ function ie(e){const[n,o]=r.useState(""),[a,s]=r.useState(""),[l,i]=r.useState(!1),[c,u]=r.useState(""),[d,p]=r.useState(""),[g,f]=r.useState("paragraph"),[m,h]=r.useState(!1),[b,y]=r.useState(""),[x,v]=r.useState(!1),k=()=>{h(!m)};return{activeBlock:g,colorMode:a,setColorMode:s,openInNewTab:l,setOpenInNewTab:i,selectedBackgroundColor:d,setSelectedBackgroundColor:p,selectedColor:c,setSelectedColor:u,selectedLanguage:b,setSelectedLanguage:y,selectedLink:n,setSelectedLink:o,showColorPicker:m,showLinkForm:x,setShowLinkForm:v,detectCurrentLanguage:()=>{const{selection:r}=e;if(r){const[r]=t.Editor.nodes(e,{match:e=>"code"===e.type});y(r?r[0].language:null)}},toggleLinkForm:()=>{v(!x)},toggleColorPicker:k,handleColorChange:t=>{H.applyTextColor(e,t),k()},handleBackgroundColorChange:t=>{H.applyBackgroundTextColor(e,t),k()},handleBlockTypeChange:t=>{H.toggleBlock(e,t),f(t)}}}function ce({selectedColor:e,onSelectColor:t,onClose:o}){const[s,l]=r.useState("#ffffff"),{editor:i,backgroundColor:c,borderColor:u,imageColor:d}=Q(),p={backgroundColor:c,color:d},g={backgroundColor:`color-mix(in srgb, ${c} 80%, ${U(c)?"white":"black"})`,color:U(c)?"#FFF":"#000"},f={backgroundColor:"#6c757d"!==c?"#6c757d":"color-mix(in srgb, #6c757d 30%, black)",color:U(c)?"#FFF":"#000"},m={default:{picker:{background:c,color:d,border:u}}};return r.useEffect(()=>{e&&l(e)},[e]),R.jsxs("div",{onMouseLeave:o,className:"rtf color-picker-popup",children:[R.jsx(a.SketchPicker,{styles:m,color:s,onChangeComplete:e=>{n.ReactEditor.focus(i),l(e.hex)}}),R.jsxs("div",{style:p,className:"rtf link-form-actions",children:[R.jsx("button",{className:"rtf",style:g,onClick:()=>{s&&(t(s),o())},disabled:!s,children:"Appliquer"}),R.jsx("button",{className:"rtf",style:f,onClick:()=>{t(""),o()},children:"Annuler"})]})]})}const ue=()=>{const{editor:e,backgroundColor:t,imageColor:r}=Q(),n=H.isBlockquoteActive(e);return R.jsx("button",{onMouseDown:t=>{t.preventDefault(),H.toggleBlockquote(e)},style:{backgroundColor:n?`color-mix(in srgb, ${t} 80%, ${U(t)?"white":"black"})`:""},className:"rtf tool",children:R.jsx(re,{format:"blockquote",imageColor:r})})},de=({text:e,children:t,position:n="top"})=>{var o;const[a,s]=r.useState(!1),{isDarkTheme:l,backgroundDarkColor:i,imageDarkColor:c}=X(),u=r.Children.count(t),d=r.Children.map(t,e=>e);return R.jsxs("div",{className:"tooltip-container",style:{display:1===u&&"none"===(null==(o=d[0].props.style)?void 0:o.display)?"none":"inline-block"},onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[t,a&&R.jsx("div",{style:{backgroundColor:l?"black":i,color:c,borderColor:c},className:`tooltip tooltip--${n} tooltip--visible`,role:"tooltip","aria-label":e,children:e})]})},pe=({activeMarks:e,format:o,isActive:a,tooltip:s})=>{const[l,i]=r.useState(""),{backgroundColor:c,editor:u,imageColor:d}=Q(),{activeBlock:p,colorMode:g,setColorMode:f,openInNewTab:m,detectCurrentLanguage:h,handleColorChange:b,handleBackgroundColorChange:y,setOpenInNewTab:x,selectedBackgroundColor:v,setSelectedBackgroundColor:k,selectedColor:w,setSelectedColor:C,selectedLink:j,setSelectedLink:F,showColorPicker:S,showLinkForm:N,setShowLinkForm:E,toggleColorPicker:L,toggleLinkForm:T}=ie(u),A="h1"===p||"h2"===p,$=["left","center","right"],M=()=>{setTimeout(()=>n.ReactEditor.focus(u),0)};return r.useEffect(()=>{h();const{selection:e}=u;if(e){const[e]=t.Editor.nodes(u,{match:e=>"link"===e.type});e?(x("_blank"===e[0].target),F(e[0].href)):(x(!1),F(""))}},[u.selection]),R.jsx(de,{text:s,position:"bottom",children:"indent"===o||"outdent"===o?R.jsx("div",{children:R.jsx("button",{title:s,className:"rtf tool",onClick:()=>"indent"===o?H.handleIndent(u):H.handleOutdent(u),disabled:!a,children:R.jsx(re,{format:o,imageColor:a?d:`color-mix(in srgb, ${d} 40%, black)`})})}):"fontSize"===o?R.jsx(ae,{disabled:A,onSelectSize:e=>{H.applyFontSize(u,e)},sizeSelected:a}):"fontFamily"===o?R.jsx(se,{fontFamilySelected:l,onSelectFontFamily:e=>{H.applyFontFamily(u,e),i(e)}}):"bulletList"===o||"numberedList"===o?R.jsx("div",{className:"rtf dropdown",children:R.jsx(ne,{format:o,isActive:a,onMouseDown:()=>{o="bulletList"===o?"bullet-list":"numbered-list",H.toggleBlock(u,o)}})}):"href"===o?R.jsxs("div",{className:"rtf dropdown",children:[R.jsx("button",{onMouseDown:e=>{e.preventDefault(),M(),T()},title:s,className:"rtf tool tool--"+(a?"active":"inactive"),children:R.jsx(re,{format:o,imageColor:d})}),N&&R.jsx(le,{onClose:()=>E(!1),initialUrl:j,isOpenInNewTab:m})]}):"color"===o||"bgColor"===o?R.jsxs("div",{className:"rtf dropdown",children:[R.jsx("button",{title:s,onMouseDown:t=>{t.preventDefault(),M(),"color"===o?(C(e[o]),f("color"),L()):(k(e[o]),f("bgColor"),L())},className:"rtf tool tool--"+(a?"active":"inactive"),children:R.jsx(re,{format:o,imageColor:d})}),S&&R.jsx(ce,{selectedColor:"color"===g?w:v,onSelectColor:"color"===g?b:y,onClose:L})]}):"blockquote"===o?R.jsx(ue,{tooltip:s}):R.jsx("button",{onMouseDown:e=>{e.preventDefault(),$.includes(o)?H.toggleAlign(u,o):H.toggleMark(u,o)},title:s,style:{backgroundColor:a?`color-mix(in srgb, ${c} 80%, ${U(c)?"white":"black"})`:""},className:"rtf tool",children:R.jsx(re,{format:o,imageColor:d})})})},ge=r.forwardRef(({tooltip:e},t)=>{const{backgroundColor:r,imageColor:n}=Q(),{editor:o}=Q(),{activeBlock:a,handleBlockTypeChange:s}=ie(o),l={backgroundColor:r,color:n};return R.jsx(de,{text:e,position:"bottom",children:R.jsx("select",{ref:t,className:"rtf",value:a,onChange:e=>{const t=e.target.value;s(t)},style:l,children:[{type:"paragraph",name:"Paragraphe"},{type:"h1",name:"Titre"},{type:"h2",name:"Sous-titre"}].map(e=>R.jsx("option",{className:"rtf",value:e.type,children:e.name},e.type))})})}),fe=r.forwardRef((e,t)=>{const[n,o]=r.useState(!1),{backgroundColor:a,editor:s,imageColor:l}=Q(),{selectedLanguage:i,setSelectedLanguage:c}=ie(s),u={backgroundColor:a,color:l},d={cs:"C#",cpp:"C++",css:"CSS",diff:"Diff",html:"HTML",java:"Java",javascript:"JavaScript",php:"PHP",python:"Python",ruby:"Ruby",typescript:"TypeScript",xml:"XML"},p=()=>{o(!n)},g=e=>{c(e),H.handleCode(s,e),o(!1)};return R.jsxs("div",{ref:t,className:"rtf dropdown tool "+(i&&"init"!==i&&""!==i?"tool--active":""),children:[R.jsx("button",{className:"rtf dropdown-toggle",onClick:p,children:R.jsx(re,{format:"blockCode",imageColor:l})}),n&&R.jsxs("ul",{style:u,onMouseLeave:p,className:"rtf dropdown-menu",children:[i&&R.jsx("li",{onClick:()=>g("init"),children:"Réinitialiser"}),Object.keys(d).map(e=>R.jsx("li",{onClick:()=>g(e),style:{cursor:"pointer",padding:"5px 10px",backgroundColor:i&&e===i?`color-mix(in srgb, ${a} 80%, ${U(a)?"white":"black"})`:a},children:d[e]},e))]})]})}),me=r.forwardRef((e,t)=>{const{editor:r,imageColor:n}=Q();return R.jsxs("div",{className:"rtf tool image-upload-container",ref:t,children:[R.jsx("input",{id:"file-input",type:"file",accept:"image/*",onChange:e=>H.handleFileChange(e,r),className:"rtf hidden-file-input"}),R.jsx("label",{htmlFor:"file-input",className:"rtf image-upload-label",children:R.jsx(re,{format:"image",imageColor:n})})]})}),he=({onClose:e})=>{const{editor:t,backgroundColor:n}=Q(),[o,a]=r.useState(0),[s,l]=r.useState(0),i={backgroundColor:n,color:U(n)?"#FFF":"#000"},c=(e,t)=>{a(e),l(t)},u=(r,n)=>{H.insertTable(t,r+1,n+1),e()};return R.jsxs("div",{style:i,className:"rtf dropdown-menu table-grid-form",children:[R.jsx("div",{className:"rtf grid-container",children:(()=>{const e=[];for(let t=0;t<5;t++)for(let r=0;r<5;r++){const n=t<=o&&r<=s;e.push(R.jsx("div",{className:"rtf grid-cell "+(n?"hovered":""),onMouseEnter:()=>c(t,r),onClick:()=>u(t,r)},`${t}-${r}`))}return e})()}),R.jsxs("div",{style:i,className:"rtf table-size-indicator",children:["Tableau de ",o+1," lignes x ",s+1," colonnes"]})]})},be=r.forwardRef(({allButtons:e,hiddenButtons:t},r)=>{const{editor:n,imageColor:o}=Q(),a=H.isSelectionInTable(n),s=[{name:"deleteTable",alt:"Supprimer le tableau",onClick:H.deleteTable},{name:"addRow",alt:"Ajouter une ligne",onClick:H.addRow},{name:"addColumn",alt:"Ajouter une colonne",onClick:H.addColumn},{name:"deleteRow",alt:"Supprimer une ligne",onClick:H.deleteRow},{name:"deleteColumn",alt:"Supprimer une colonne",onClick:H.deleteColumn}];return R.jsx(R.Fragment,{children:s.map((s,l)=>{var i,c;return R.jsx(de,{text:e.find(e=>e.format===s.name).tooltip,position:"bottom",children:R.jsx("button",{ref:e=>r.current[s.name]=e,className:"rtf tool",style:{display:t.includes(s.name)?"none":"inline-block"},onClick:()=>s.onClick(n),disabled:!a,children:R.jsx(re,{format:s.name,imageColor:a?H.getTableFromSelection(n)?"addRow"===s.name?H.getTableFromSelection(n).children.length>=5?`color-mix(in srgb, ${o} 40%, ${U(o)?"white":"black"})`:o:"addColumn"===s.name?(null==(i=H.getTableFromSelection(n).children[0])?void 0:i.children.length)>=5?`color-mix(in srgb, ${o} 40%, ${U(o)?"white":"black"})`:o:"deleteColumn"===s.name?1===(null==(c=H.getTableFromSelection(n).children[0])?void 0:c.children.length)?`color-mix(in srgb, ${o} 40%, ${U(o)?"white":"black"})`:o:"deleteRow"===s.name&&1===H.getTableFromSelection(n).children.length?`color-mix(in srgb, ${o} 40%, ${U(o)?"white":"black"})`:o:o:`color-mix(in srgb, ${o} 40%, ${U(o)?"white":"black"})`})})},l)})})}),ye=({activeMarks:e})=>{const[t,n]=r.useState(!1),[o,a]=r.useState([]),s=r.useRef(null),l=r.useRef({}),{editor:i,imageColor:c,backgroundColor:u}=Q(),d=[{format:"blockType",tooltip:"Insérer un bloc de texte"},{format:"bold",tooltip:"Gras (Ctrl+B)"},{format:"underline",tooltip:"Souligné (Ctrl+U)"},{format:"italic",tooltip:"Italique (Ctrl+I)"},{format:"strikethrough",tooltip:"Barré"},{format:"subscript",tooltip:"Indice"},{format:"superscript",tooltip:"Exposant"},{format:"blockquote",tooltip:"Citation"},{format:"color",tooltip:"Couleur du texte"},{format:"bgColor",tooltip:"Couleur de fond"},{format:"fontSize",tooltip:"Taille de texte"},{format:"fontFamily",tooltip:"Police d'écriture"},{format:"href",tooltip:"Insérer un lien (Ctrl+K)"},{format:"bulletList",tooltip:"Liste à puces (Ctrl+L)"},{format:"numberedList",tooltip:"Liste à puces (Ctrl+N)"},{format:"left",tooltip:"Gauche"},{format:"center",tooltip:"Centré"},{format:"right",tooltip:"Droite"},{format:"indent",tooltip:"Indenté"},{format:"outdent",tooltip:"Retrait"},{format:"table",tooltip:"Insérer un tableau"},{format:"deleteTable",tooltip:"Supprimer un tableau"},{format:"addRow",tooltip:"Insérer une ligne"},{format:"addColumn",tooltip:"Insérer une colonne"},{format:"deleteRow",tooltip:"Supprimer une ligne"},{format:"deleteColumn",tooltip:"Supprimer une colonne"},{format:"image",tooltip:"Insérer une image"},{format:"code",tooltip:"Bloc de code (Ctrl+E)"},{format:"undo",tooltip:"Annuler (Ctrl+Z)"},{format:"redo",tooltip:"Rétablir (Ctrl+Y)"}],[p,g]=r.useState(!1),f=["deleteTable","addRow","addColumn","deleteRow","deleteColumn"],m=()=>{g(!p)};return r.useEffect(()=>{if(!s.current)return;const e=new ResizeObserver(()=>{(()=>{if(s.current){const e=s.current.clientWidth-15;if(978>e){let t=0;const r=[];d.forEach(n=>{const o=l.current[n.format];o&&(t+=("blockType"===n.format?o.clientWidth:25)+5,t<=e&&r.push(n.format))});const n=d.map(e=>e.format).filter(e=>!r.includes(e));a(n)}else a([])}})()});return e.observe(s.current),()=>{e.disconnect()}},[]),R.jsxs("div",{className:"rtf toolbar-container",children:[R.jsxs("div",{className:"rtf toolbar",onClick:()=>{document.querySelector(".rtf.toolbar").blur()},ref:s,children:[R.jsx(ge,{ref:e=>l.current.blockType=e,tooltip:d.find(e=>"blockType"===e.format).tooltip}),Object.keys(e).map((t,r)=>R.jsx("div",{className:"rtf",ref:e=>l.current[t]=e,style:{display:o.includes(t)?"none":"inline-block"},children:R.jsx(pe,{activeMarks:e,format:t,isActive:e[t],tooltip:d.find(e=>e.format===t).tooltip})},r)),R.jsxs("div",{className:"rtf dropdown tool",style:{display:o.includes("table")?"none":"flex",padding:o.includes("table")?0:5},children:[R.jsx(de,{text:d.find(e=>"table"===e.format).tooltip,position:"bottom",children:R.jsx("button",{ref:e=>l.current.table=e,onClick:m,className:"rtf dropdown-toggle",children:R.jsx(re,{format:"table",imageColor:c})})}),p&&!o.includes("table")&&R.jsx(he,{onClose:m})]}),R.jsx(be,{allButtons:d,hiddenButtons:o,ref:l}),!o.includes("image")&&R.jsx(de,{text:d.find(e=>"image"===e.format).tooltip,position:"bottom",children:R.jsx(me,{ref:e=>l.current.image=e})}),!o.includes("code")&&R.jsx(de,{text:d.find(e=>"code"===e.format).tooltip,position:"bottom",children:R.jsx(fe,{ref:e=>l.current.code=e})}),["undo","redo"].map(e=>!o.includes(e)&&R.jsx(de,{text:d.find(t=>t.format===e).tooltip,position:"bottom",children:R.jsx("button",{ref:t=>l.current[e]=t,className:"rtf tool",style:{display:o.includes(e)?"none":"inline-block"},onMouseDown:t=>{t.preventDefault(),"undo"===e?i.undo():"redo"===e&&i.redo()},children:R.jsx(re,{format:e,imageColor:0===i.history[e+"s"].length?`color-mix(in srgb, ${c} 40%, ${U(c)?"white":"black"})`:c})},e)},e)),o.length>0&&R.jsx(de,{text:"Voir plus",position:"bottom",children:R.jsx("button",{className:"rtf tool toolbar-more-button",onClick:()=>n(e=>!e),children:R.jsx(re,{format:"more",imageColor:c})})})]}),t&&R.jsx("div",{className:"rtf toolbar-modal",style:{backgroundColor:u},onMouseLeave:()=>n(!1),children:o.map(t=>"image"===t||"code"===t||"table"===t||"deleteTable"===t||"addRow"===t||"addColumn"===t||"deleteRow"===t||"deleteColumn"===t?"image"===t?R.jsx(me,{ref:e=>l.current.image=e},t):"code"===t?R.jsx(fe,{ref:e=>l.current.code=e},t):"table"===t?R.jsx("div",{className:"rtf dropdown tool",children:R.jsx(de,{text:d.find(e=>e.format===t).tooltip,position:"bottom",children:R.jsx("button",{className:"rtf dropdown-toggle",ref:e=>l.current[t]=e,onClick:m,children:R.jsx(re,{format:t,imageColor:c})})},t)}):f.includes(t)?R.jsx(be,{allButtons:d,hiddenButtons:f.filter(e=>e!==t),ref:l},t):null:R.jsx(pe,{activeMarks:e,format:t,isActive:e[t],tooltip:d.find(e=>e.format===t).tooltip},t))})]})},xe=({toggleColor:e,fullScreen:t})=>{const{isDarkTheme:r,toggleTheme:n}=X();return R.jsxs("label",{className:"rtf toggle-switch",style:{right:t?55:20},children:[R.jsx("input",{className:"rtf",type:"checkbox",checked:r,onChange:n}),R.jsx("span",{className:"rtf slider round",style:{borderColor:e},children:R.jsx("span",{className:"rtf icon",style:{backgroundColor:e},children:R.jsx("span",{children:r?"🌙":"🌞"})})})]})};function ve({children:e}){const{editor:t,imageColor:n}=Q(),o=r.useId();return R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"rtf tool table__tool",onClick:()=>{return e=o,void H.insertParagraphBeforeTable(t,e);var e},children:R.jsx(re,{format:"enter",imageColor:n})}),R.jsx("table",{className:"rtf","data-table-id":o,children:R.jsx("tbody",{children:e})}),R.jsx("div",{className:"rtf tool table__tool",onClick:()=>{H.insertParagraphAfterTable(t,o)},children:R.jsx(re,{format:"enter",imageColor:n})})]})}const ke=r.createContext({isFullscreen:!1,toggleFullscreen:()=>{}}),we=({children:e})=>{const[t,n]=r.useState(!1);return r.useEffect(()=>{const e=()=>{t&&window.innerWidth<768&&n(!1)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[t]),R.jsx(ke.Provider,{value:{isFullscreen:t,toggleFullscreen:()=>{n(!t)}},children:e})},Ce=()=>r.useContext(ke),je=({children:e})=>{const{isFullscreen:t}=Ce(),n=r.useRef(null);return r.useEffect(()=>(document.body.style.overflow=t?"hidden":"",()=>{document.body.style.overflow=""}),[t]),R.jsx("div",{ref:n,className:"rtf fullscreen-wrapper "+(t?"fullscreen-wrapper--active":""),children:e})},Fe=()=>{const{isFullscreen:e,toggleFullscreen:t}=Ce(),{backgroundColor:r,imageColor:n}=Q();return R.jsx("div",{className:"rtf fullscreen-button",children:R.jsx(de,{position:"bottom",text:e?"Quitter le mode plein écran (Esc)":"Passer en mode plein écran",children:R.jsx("button",{onClick:t,className:"rtf tool "+(e?"tool--active":""),style:{backgroundColor:e?`color-mix(in srgb, ${r} 80%, ${U(r)?"white":"black"})`:""},children:R.jsx(re,{format:"fullscreen"+(e?"Exit":""),imageColor:n})})})})};var Se,Ne={exports:{}};var Ee,Le,Te=(Se||(Se=1,Ee=Ne,Le=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,r=0,n={},o={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++r}),e.__id},clone:function e(t,r){var n,a;switch(r=r||{},o.util.type(t)){case"Object":if(a=o.util.objId(t),r[a])return r[a];for(var s in n={},r[a]=n,t)t.hasOwnProperty(s)&&(n[s]=e(t[s],r));return n;case"Array":return a=o.util.objId(t),r[a]?r[a]:(n=[],r[a]=n,t.forEach(function(t,o){n[o]=e(t,r)}),n);default:return t}},getLanguage:function(e){for(;e;){var r=t.exec(e.className);if(r)return r[1].toLowerCase();e=e.parentElement}return"none"},setLanguage:function(e,r){e.className=e.className.replace(RegExp(t,"gi"),""),e.classList.add("language-"+r)},currentScript:function(){if("undefined"==typeof document)return null;if(document.currentScript&&"SCRIPT"===document.currentScript.tagName)return document.currentScript;try{throw new Error}catch(n){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(n.stack)||[])[1];if(e){var t=document.getElementsByTagName("script");for(var r in t)if(t[r].src==e)return t[r]}return null}},isActive:function(e,t,r){for(var n="no-"+t;e;){var o=e.classList;if(o.contains(t))return!0;if(o.contains(n))return!1;e=e.parentElement}return!!r}},languages:{plain:n,plaintext:n,text:n,txt:n,extend:function(e,t){var r=o.util.clone(o.languages[e]);for(var n in t)r[n]=t[n];return r},insertBefore:function(e,t,r,n){var a=(n=n||o.languages)[e],s={};for(var l in a)if(a.hasOwnProperty(l)){if(l==t)for(var i in r)r.hasOwnProperty(i)&&(s[i]=r[i]);r.hasOwnProperty(l)||(s[l]=a[l])}var c=n[e];return n[e]=s,o.languages.DFS(o.languages,function(t,r){r===c&&t!=e&&(this[t]=s)}),s},DFS:function e(t,r,n,a){a=a||{};var s=o.util.objId;for(var l in t)if(t.hasOwnProperty(l)){r.call(t,l,t[l],n||l);var i=t[l],c=o.util.type(i);"Object"!==c||a[s(i)]?"Array"!==c||a[s(i)]||(a[s(i)]=!0,e(i,r,l,a)):(a[s(i)]=!0,e(i,r,null,a))}}},plugins:{},highlightAll:function(e,t){o.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,r){var n={callback:r,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};o.hooks.run("before-highlightall",n),n.elements=Array.prototype.slice.apply(n.container.querySelectorAll(n.selector)),o.hooks.run("before-all-elements-highlight",n);for(var a,s=0;a=n.elements[s++];)o.highlightElement(a,!0===t,n.callback)},highlightElement:function(t,r,n){var a=o.util.getLanguage(t),s=o.languages[a];o.util.setLanguage(t,a);var l=t.parentElement;l&&"pre"===l.nodeName.toLowerCase()&&o.util.setLanguage(l,a);var i={element:t,language:a,grammar:s,code:t.textContent};function c(e){i.highlightedCode=e,o.hooks.run("before-insert",i),i.element.innerHTML=i.highlightedCode,o.hooks.run("after-highlight",i),o.hooks.run("complete",i),n&&n.call(i.element)}if(o.hooks.run("before-sanity-check",i),(l=i.element.parentElement)&&"pre"===l.nodeName.toLowerCase()&&!l.hasAttribute("tabindex")&&l.setAttribute("tabindex","0"),!i.code)return o.hooks.run("complete",i),void(n&&n.call(i.element));if(o.hooks.run("before-highlight",i),i.grammar)if(r&&e.Worker){var u=new Worker(o.filename);u.onmessage=function(e){c(e.data)},u.postMessage(JSON.stringify({language:i.language,code:i.code,immediateClose:!0}))}else c(o.highlight(i.code,i.grammar,i.language));else c(o.util.encode(i.code))},highlight:function(e,t,r){var n={code:e,grammar:t,language:r};if(o.hooks.run("before-tokenize",n),!n.grammar)throw new Error('The language "'+n.language+'" has no grammar.');return n.tokens=o.tokenize(n.code,n.grammar),o.hooks.run("after-tokenize",n),a.stringify(o.util.encode(n.tokens),n.language)},tokenize:function(e,t){var r=t.rest;if(r){for(var n in r)t[n]=r[n];delete t.rest}var o=new i;return c(o,o.head,e),l(e,o,t,o.head,0),function(e){for(var t=[],r=e.head.next;r!==e.tail;)t.push(r.value),r=r.next;return t}(o)},hooks:{all:{},add:function(e,t){var r=o.hooks.all;r[e]=r[e]||[],r[e].push(t)},run:function(e,t){var r=o.hooks.all[e];if(r&&r.length)for(var n,a=0;n=r[a++];)n(t)}},Token:a};function a(e,t,r,n){this.type=e,this.content=t,this.alias=r,this.length=0|(n||"").length}function s(e,t,r,n){e.lastIndex=t;var o=e.exec(r);if(o&&n&&o[1]){var a=o[1].length;o.index+=a,o[0]=o[0].slice(a)}return o}function l(e,t,r,n,i,d){for(var p in r)if(r.hasOwnProperty(p)&&r[p]){var g=r[p];g=Array.isArray(g)?g:[g];for(var f=0;f<g.length;++f){if(d&&d.cause==p+","+f)return;var m=g[f],h=m.inside,b=!!m.lookbehind,y=!!m.greedy,x=m.alias;if(y&&!m.pattern.global){var v=m.pattern.toString().match(/[imsuy]*$/)[0];m.pattern=RegExp(m.pattern.source,v+"g")}for(var k=m.pattern||m,w=n.next,C=i;w!==t.tail&&!(d&&C>=d.reach);C+=w.value.length,w=w.next){var j=w.value;if(t.length>e.length)return;if(!(j instanceof a)){var F,S=1;if(y){if(!(F=s(k,C,e,b))||F.index>=e.length)break;var N=F.index,E=F.index+F[0].length,L=C;for(L+=w.value.length;N>=L;)L+=(w=w.next).value.length;if(C=L-=w.value.length,w.value instanceof a)continue;for(var T=w;T!==t.tail&&(L<E||"string"==typeof T.value);T=T.next)S++,L+=T.value.length;S--,j=e.slice(C,L),F.index-=C}else if(!(F=s(k,0,j,b)))continue;N=F.index;var A=F[0],$=j.slice(0,N),M=j.slice(N+A.length),z=C+j.length;d&&z>d.reach&&(d.reach=z);var _=w.prev;if($&&(_=c(t,_,$),C+=$.length),u(t,_,S),w=c(t,_,new a(p,h?o.tokenize(A,h):A,x,A)),M&&c(t,w,M),S>1){var O={cause:p+","+f,reach:z};l(e,t,r,w.prev,C,O),d&&O.reach>d.reach&&(d.reach=O.reach)}}}}}}function i(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,r){var n=t.next,o={value:r,prev:t,next:n};return t.next=o,n.prev=o,e.length++,o}function u(e,t,r){for(var n=t.next,o=0;o<r&&n!==e.tail;o++)n=n.next;t.next=n,n.prev=t,e.length-=o}if(e.Prism=o,a.stringify=function e(t,r){if("string"==typeof t)return t;if(Array.isArray(t)){var n="";return t.forEach(function(t){n+=e(t,r)}),n}var a={type:t.type,content:e(t.content,r),tag:"span",classes:["token",t.type],attributes:{},language:r},s=t.alias;s&&(Array.isArray(s)?Array.prototype.push.apply(a.classes,s):a.classes.push(s)),o.hooks.run("wrap",a);var l="";for(var i in a.attributes)l+=" "+i+'="'+(a.attributes[i]||"").replace(/"/g,"&quot;")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+l+">"+a.content+"</"+a.tag+">"},!e.document)return e.addEventListener?(o.disableWorkerMessageHandler||e.addEventListener("message",function(t){var r=JSON.parse(t.data),n=r.language,a=r.code,s=r.immediateClose;e.postMessage(o.highlight(a,o.languages[n],n)),s&&e.close()},!1),o):o;var d=o.util.currentScript();function p(){o.manual||o.highlightAll()}if(d&&(o.filename=d.src,d.hasAttribute("data-manual")&&(o.manual=!0)),!o.manual){var g=document.readyState;"loading"===g||"interactive"===g&&d&&d.defer?document.addEventListener("DOMContentLoaded",p):window.requestAnimationFrame?window.requestAnimationFrame(p):window.setTimeout(p,16)}return o}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{}),Ee.exports&&(Ee.exports=Le),void 0!==A&&(A.Prism=Le),Le.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Le.languages.markup.tag.inside["attr-value"].inside.entity=Le.languages.markup.entity,Le.languages.markup.doctype.inside["internal-subset"].inside=Le.languages.markup,Le.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&amp;/,"&"))}),Object.defineProperty(Le.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Le.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};n["language-"+t]={pattern:/[\s\S]+/,inside:Le.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:n},Le.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(Le.languages.markup.tag,"addAttribute",{value:function(e,t){Le.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Le.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Le.languages.html=Le.languages.markup,Le.languages.mathml=Le.languages.markup,Le.languages.svg=Le.languages.markup,Le.languages.xml=Le.languages.extend("markup",{}),Le.languages.ssml=Le.languages.xml,Le.languages.atom=Le.languages.xml,Le.languages.rss=Le.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var r=e.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(Le),Le.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Le.languages.javascript=Le.languages.extend("clike",{"class-name":[Le.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Le.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Le.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Le.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Le.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Le.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Le.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Le.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Le.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Le.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Le.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Le.languages.markup&&(Le.languages.markup.tag.addInlined("script","javascript"),Le.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Le.languages.js=Le.languages.javascript,function(){if(void 0!==Le&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",r="loading",n="loaded",o="pre[data-src]:not(["+t+'="'+n+'"]):not(['+t+'="'+r+'"])';Le.hooks.add("before-highlightall",function(e){e.selector+=", "+o}),Le.hooks.add("before-sanity-check",function(a){var s=a.element;if(s.matches(o)){a.code="",s.setAttribute(t,r);var l=s.appendChild(document.createElement("CODE"));l.textContent="Loading…";var i=s.getAttribute("data-src"),c=a.language;if("none"===c){var u=(/\.(\w+)$/.exec(i)||[,"none"])[1];c=e[u]||u}Le.util.setLanguage(l,c),Le.util.setLanguage(s,c);var d=Le.plugins.autoloader;d&&d.loadLanguages(c),function(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.onreadystatechange=function(){4==n.readyState&&(n.status<400&&n.responseText?t(n.responseText):n.status>=400?r("✖ Error "+n.status+" while fetching file: "+n.statusText):r("✖ Error: File does not exist or is empty"))},n.send(null)}(i,function(e){s.setAttribute(t,n);var r=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var r=Number(t[1]),n=t[2],o=t[3];return n?o?[r,Number(o)]:[r,void 0]:[r,r]}}(s.getAttribute("data-range"));if(r){var o=e.split(/\r\n?|\n/g),a=r[0],i=null==r[1]?o.length:r[1];a<0&&(a+=o.length),a=Math.max(0,Math.min(a-1,o.length)),i<0&&(i+=o.length),i=Math.max(0,Math.min(i,o.length)),e=o.slice(a,i).join("\n"),s.hasAttribute("data-start")||s.setAttribute("data-start",String(a+1))}l.textContent=e,Le.highlightElement(l)},function(e){s.setAttribute(t,"failed"),l.textContent=e})}}),Le.plugins.fileHighlight={highlight:function(e){for(var t,r=(e||document).querySelectorAll(o),n=0;t=r[n++];)Le.highlightElement(t)}};var a=!1;Le.fileHighlight=function(){a||(a=!0),Le.plugins.fileHighlight.highlight.apply(this,arguments)}}}()),Ne.exports);const Ae=$(Te);Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript;var $e;$e||($e=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(e){return e=e.replace(/<inner>/g,function(){return t}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var n=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return n}),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+o+a+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+a+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(n),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(n),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(t){["url","bold","italic","strike","code-snippet"].forEach(function(r){t!==r&&(e.languages.markdown[t].inside.content.inside[r]=e.languages.markdown[r])})}),e.hooks.add("after-tokenize",function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var r=0,n=t.length;r<n;r++){var o=t[r];if("code"===o.type){var a=o.content[1],s=o.content[3];if(a&&s&&"code-language"===a.type&&"code-block"===s.type&&"string"==typeof a.content){var l=a.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),i="language-"+(l=(/[a-z][\w-]*/i.exec(l)||[""])[0].toLowerCase());s.alias?"string"==typeof s.alias?s.alias=[s.alias,i]:s.alias.push(i):s.alias=[i]}}else e(o.content)}}(e.tokens)}),e.hooks.add("wrap",function(t){if("code-block"===t.type){for(var r="",n=0,o=t.classes.length;n<o;n++){var a=t.classes[n],c=/language-(.+)/.exec(a);if(c){r=c[1];break}}var u,d=e.languages[r];if(d)t.content=e.highlight((u=t.content,u.replace(s,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(e,t){var r;if("#"===(t=t.toLowerCase())[0])return r="x"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1)),i(r);var n=l[t];return n||e})),d,r);else if(r&&"none"!==r&&e.plugins.autoloader){var p="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());t.attributes.id=p,e.plugins.autoloader.loadLanguages(r,function(){var t=document.getElementById(p);t&&(t.innerHTML=e.highlight(t.textContent,e.languages[r],r))})}}});var s=RegExp(e.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},i=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Prism),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var r=e.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))}(Prism);
141
+ /**
142
+ * @license
143
+ * Copyright (c) 2025 Jahylis
144
+ *
145
+ * This file is part of ReactTextForge.
146
+ *
147
+ * ReactTextForge is free software: you can redistribute it and/or modify
148
+ * it under the terms of the MIT License as published by
149
+ * the Open Source Initiative.
150
+ *
151
+ * ReactTextForge is distributed in the hope that it will be useful,
152
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
153
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
154
+ * MIT License for more details.
155
+ *
156
+ * You should have received a copy of the MIT License
157
+ * along with ReactTextForge. If not, see <https://opensource.org/licenses/MIT>.
158
+ *
159
+ * For any questions or suggestions, please contact: administrateur@nhumeria.fr
160
+ */
161
+ e.default=({value:e,setValue:a,fullScreen:l=!0,showTheme:i=!0,borderColor:c="#ccc",backgroundColor:u="#FFF",imageColor:d="#000",borderDarkColor:p="#1A1A1A",backgroundDarkColor:g="#444444",imageDarkColor:f="#ffffff",toggleColor:m="#2584aa",raccourcis:h=null})=>{const[b]=r.useState(()=>s.withDocxDeserializer(o.withHistory(n.withReact(t.createEditor())))),[y,x]=r.useState({bold:!1,underline:!1,italic:!1,strikethrough:!1,subscript:!1,superscript:!1,blockquote:!1,color:"",bgColor:"",fontSize:"",fontFamily:"",href:"",bulletList:!1,numberedList:!1,left:!1,center:!1,right:!1,indent:!1,outdent:!1}),v=r.useMemo(()=>e||[{type:"paragraph",children:[{text:""}]}],[]),k=r.useRef([]),w=r.useCallback(e=>{switch(e.element.type){case"code":return R.jsx(I,{...e});case"bullet-list":case"numbered-list":case"list-item":return R.jsx(Z,{...e});case"h1":return R.jsx("h1",{className:"rtf",...e.attributes,children:e.children});case"h2":return R.jsx("h2",{className:"rtf",...e.attributes,children:e.children});case"blockquote":return R.jsx(W,{...e});case"image":return R.jsx("img",{className:"rtf",src:e.element.url,alt:"",...e.attributes});case"table":return R.jsx(ve,{...e});case"table-row":return R.jsx("tr",{className:"rtf",children:e.children});case"table-cell":return R.jsx("td",{className:"rtf",children:e.children});default:return R.jsx(q,{...e})}},[]),C=r.useCallback(e=>R.jsx(V,{...e}),[]),j=r.useCallback(()=>{const e=t.Editor.marks(b),r=H.isSelectionInList(b);x(n=>{const o={};for(const a in n)if("bulletList"===a||"numberedList"===a){const e="bulletList"===a?"bullet-list":"numberedList"===a?"numbered-list":"";o[a]=r&&H.isBlockActive(b,e)}else if("left"===a||"center"===a||"right"===a)o[a]=H.isAlignActive(b,a);else if("indent"===a||"outdent"===a)o[a]=H.canIndent(b,a);else if("href"===a){let e="";if(H.isLinkActive(b)){const r=t.Editor.nodes(b,{match:e=>"link"===e.type,mode:"highest"});for(const[t]of r)if(t&&t.href){e=t.href;break}}o[a]=e}else o[a]="color"===a?(null==e?void 0:e.color)||null:"fontSize"===a?(null==e?void 0:e.fontSize)||null:!0===(null==e?void 0:e[a]);return o})},[b]);return r.useEffect(()=>{if(null!==h){const e=e=>{Object.keys(h).forEach(t=>{const r=t.split("+"),n=r.pop().toLowerCase(),o=r.map(e=>e.toLowerCase()),a={ctrl:e.ctrlKey,shift:e.shiftKey,alt:e.altKey,meta:e.metaKey},s=o.every(e=>a[e]),l=e.key.toLowerCase()===n;s&&l&&h[t](e)})};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}},[h]),r.useEffect(()=>{null==e&&t.Transforms.delete(b,{at:{anchor:t.Editor.start(b,[]),focus:t.Editor.end(b,[])}})},[e]),R.jsx(K,{showTheme:i,borderDarkColor:p,backgroundDarkColor:g,imageDarkColor:f,children:R.jsx(we,{children:R.jsx(je,{children:R.jsx(Y,{backgroundColor:u,borderColor:c,editor:b,imageColor:d,children:R.jsxs(n.Slate,{editor:b,initialValue:v,value:e,onChange:e=>{j();if(b.operations.some(e=>"set_selection"!==e.type)){const t=JSON.stringify(e);a(e),localStorage.setItem("content",t)}},children:[R.jsx(ye,{activeMarks:y}),R.jsx(n.Editable,{className:"rtf rtf__editor",decorate:([e,r])=>{const n=[];if(!t.Element.isElement(e))return n;const o=t.Node.string(e),a=r[0],s=k.current[a];if(s&&s.text==o)return s.ranges;const l=Ae.tokenize(o,Ae.languages.javascript);let i=0;for(const t of l){const e=i+t.length;"string"!=typeof t&&n.push({anchor:{path:r,offset:i},focus:{path:r,offset:e},className:`token ${t.type}`}),i=e}return k.current[a]={text:o,ranges:n},n},renderElement:w,renderLeaf:C,style:{borderColor:c,paddingBottom:i||l?35:10},onPaste:async e=>{if(H.isSelectionInCode(b)){const t=e.clipboardData.getData("text/plain");if(t){(t.includes("\n")||t.match(/^\s{2,}/gm))&&(e.preventDefault(),H.insertCodeBlock(b,t))}return}const t=e.clipboardData.getData("text/html");if(t){e.preventDefault();const r=(e=>{const t=e=>{if(e.nodeType===Node.TEXT_NODE){const t=e.textContent.trim();return""===t?null:t}if(e.nodeType!==Node.ELEMENT_NODE)return null;const r=Array.from(e.childNodes).map(t).flat().filter(Boolean),n={bold:"B"===e.nodeName||"STRONG"===e.nodeName||"bold"===e.style.fontWeight||"700"===e.style.fontWeight,italic:"I"===e.nodeName||"EM"===e.nodeName||"italic"===e.style.fontStyle,underline:"U"===e.nodeName||e.style.textDecoration&&e.style.textDecoration.includes("underline"),fontSize:e.style.fontSize||"FONT"===e.nodeName&&e.getAttribute("size"),fontFamily:e.style.fontFamily||"FONT"===e.nodeName&&e.getAttribute("face"),color:e.style.color||"FONT"===e.nodeName&&e.getAttribute("color"),align:e.getAttribute("align")};let o;switch(e.nodeName){case"P":o=L("element",{type:"paragraph",align:n.align,size:n.fontSize},r.length?r:[{text:""}]);break;case"PRE":o=L("element",{type:"code"},r.length?r:[{text:""}]);break;case"UL":o=L("element",{type:"bullet-list"},r);break;case"OL":o=L("element",{type:"numbered-list"},r);break;case"LI":o=L("element",{type:"list-item"},r.length?r:[{text:""}]);break;case"H1":o=L("element",{type:"h1"},r.length?r:[{text:""}]);break;case"H2":case"H3":case"H4":case"H5":case"H6":o=L("element",{type:"h2",align:n.align},r.length?r:[{text:""}]);break;case"BLOCKQUOTE":o=L("element",{type:"blockquote",align:n.align},r.length?r:[{text:""}]);break;case"IMG":o=L("element",{type:"image",url:e.getAttribute("src")});break;case"TABLE":o=L("element",{type:"table"},r);break;case"TR":o=L("element",{type:"table-row"},r);break;case"TD":o=L("element",{type:"table-cell"},r);break;case"A":o=L("element",{type:"link",url:e.getAttribute("href")},r.length?r:[{text:""}]);break;default:o=r.map(e=>"string"==typeof e?L("text",n,e):e).filter(Boolean)}return o};return Array.from(e.childNodes).map(t).flat().filter(Boolean)})((new DOMParser).parseFromString(t,"text/html").body);b.insertFragment(r)}},onKeyDown:e=>{if("Tab"!==e.key){if("Enter"!==e.key||e.ctrlKey||(H.isSelectionInTable(b)||H.isSelectionInCode(b)||H.isBlockquoteActive(b))&&(e.preventDefault(),b.insertText("\n")),e.ctrlKey)switch(e.key){case"=":e.preventDefault(),H.toggleBlock(b,"code");break;case"b":e.preventDefault(),H.toggleMark(b,"bold");break;case"i":e.preventDefault(),H.toggleMark(b,"italic");break;case"u":e.preventDefault(),H.toggleMark(b,"underline");break;case"s":e.preventDefault(),H.toggleMark(b,"strikethrough");break;case"sub":e.preventDefault(),H.toggleMark(b,"subscript");break;case"sup":e.preventDefault(),H.toggleMark(b,"superscript");break;case"l":e.preventDefault(),H.toggleBlock(b,"bulletList");break;case"n":e.preventDefault(),H.toggleBlock(b,"numberedList");break;case"left":e.preventDefault(),H.toggleMark(b,"left");break;case"center":e.preventDefault(),H.toggleMark(b,"center");break;case"right":e.preventDefault(),H.toggleMark(b,"right");break;case"Enter":{e.preventDefault();const{selection:r}=b;if(r){const[e]=t.Editor.nodes(b,{match:e=>t.Element.isElement(e)&&"paragraph"!==e.type});e&&t.Transforms.insertNodes(b,t.Transforms.insertNodes(b,{type:"paragraph",children:[{text:""}]}))}break}}}else(e=>{e.shiftKey&&H.canIndent(b,"outdent")?(e.preventDefault(),H.handleOutdent(b)):H.canIndent(b,"indent")&&(e.preventDefault(),H.handleIndent(b))})(e)}}),i&&R.jsx(xe,{toggleColor:m,fullScreen:l}),l&&R.jsx(Fe,{})]})})})})})},e.deserialize=e=>{const t=(new DOMParser).parseFromString(e,"text/html"),r=e=>{if(e.nodeType===Node.TEXT_NODE)return e.textContent;if(e.nodeType!==Node.ELEMENT_NODE)return null;const t=Array.from(e.childNodes).map(r).flat().filter(Boolean),n={bold:null!==e.querySelector("strong"),italic:null!==e.querySelector("em"),underline:null!==e.querySelector("u"),strikethrough:null!==e.querySelector("del"),subscript:null!==e.querySelector("sub"),superscript:null!==e.querySelector("sup"),bgColor:e.style.backgroundColor||e.querySelector("mark")&&e.querySelector("mark").style.backgroundColor,color:e.style.color,fontSize:e.style.fontSize,fontFamily:e.style.fontFamily,href:"A"===e.nodeName?e.getAttribute("href"):null,target:"A"===e.nodeName?e.getAttribute("target"):null,rel:"A"===e.nodeName?e.getAttribute("rel"):null};switch(e.nodeName){case"P":return L("element",{type:"paragraph"},t);case"PRE":return L("element",{type:"code"},t);case"UL":return L("element",{type:"bullet-list"},t);case"OL":return L("element",{type:"numbered-list"},t);case"LI":return L("element",{type:"list-item"},t);case"H1":return L("element",{type:"h1"},t);case"H2":return L("element",{type:"h2"},t);case"BLOCKQUOTE":return L("element",{type:"blockquote"},t);case"IMG":return L("element",{type:"image",url:e.getAttribute("src")});case"TABLE":return L("element",{type:"table"},t);case"TR":return L("element",{type:"table-row"},t);case"TD":return L("element",{type:"table-cell"},t);case"A":return L("element",{type:"link",url:e.getAttribute("href")},t);default:return t.map(e=>"string"==typeof e?L("text",n,e):e)}};return Array.from(t.body.childNodes).map(r).flat().filter(Boolean)},e.serialize=T,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});